View Single Post
  #7 (permalink)  
Old 02-18-2008, 09:53 PM
prasannavigneshr prasannavigneshr is offline
D-Web Incredible
 
Join Date: Feb 2007
Posts: 1,321
prasannavigneshr is on a distinguished road
Send a message via MSN to prasannavigneshr
Thumbs up ColdFusion Tips & Tricks - Changing the action field of a form tag

Changing the action field of a form tag


If you want to have one form but have it jump to different pages based off of what button a user clicks on, you can use the following example to change the form.action value.

Example HTML/CFML code:

Code:
<html>
<head>
<!--- Set up the javascript to change the action url --->
<script language="Javascript">

function SetURL(site)
{
  if (site == '1') document.myform.action='http://www.allaire.com/';
  if (site == '2') document.myform.action='http://www.allaire.com/developer/gallery/index.cfm?objectID=6800';
  document.myform.submit();
}

</script>
</head>
<body>
<!--- No action field specified, will default to load the same document --->
<center>
<form name="myform" method="get">
<input type="Button" value="Allaire's Homepage" onClick="SetURL('1')"><br><br>
<input type="Button" value="Tag Gallery" onClick="SetURL('2')"><br>
</form>
</center>
</body>
__________________
Prasanna Vignesh
MCPD | Web Developer
Reply With Quote