Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Doing two things with one Submit Button?

Status
Not open for further replies.

countdrak

Programmer
Jun 20, 2003
358
US
First the code,

<form name="form1" method="post" action="index.cfm">
<select size="1" name="check" onChange="this.form.submit();">
<option value="Phone">Phone</option>
<option value="Televison">Television</option></select>
IF Phone is picked populate second box
<select size="1" name="item" onChange="this.form.submit();">
<option value="Nokia">Nokia</option>
<option value="Motorola">Motorola</option></select>
.................

End if
<input name="Submit" type="button" value="Submit">
</form>


Now here is my problem....to populate the second box I have to submit my form to itself depending on the choice made in the first box, but if the submit button is clicked I need the form to submit to a diffrent page. How do I catch the Submit event so I know the user is trying to submit the form? I am using coldfusion. Thanks a lot for the help.
 
Wouldn't it be easier to create a javascript function to test the values of the first selection? That way, you wouldn't have to trap the submit button.

There's always a better way. The fun is trying to find it!
 
You could use different <div>s and just display or hide them accordingly...

Or, if you don't want to rely on JavaScript, you can always make it a two-step (or multiple-step) submission. First let the user decide if it's a phone or a tv, then submit, and then show the second box in a new window, with a link back...

haslo@haslo.ch - www.haslo.ch​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top