By: Rhino
Form with 2 Submit Buttons
Form with 2 Submit Buttons

I needed a form with two submit buttons to do two different things. Here's an easy way to do it.

First create a form. Then create one submit button as usual.

Then copy that one as many times as you want and use name="[same-name]", but make the values different like this:

<input type="submit" value="Display" name="choose">
<input type="submit" value="Count" name="choose">
<input type="submit" value="Email" name="choose">

Then on your process form simply use:

<CFIF form.choose is "Display">

<CFELSEIF form.choose is "Count">

and so on...

You could also use CFSWITCH I suppose.

About This Tutorial
Author: Rhino
Skill Level: Beginner 
 
 
 
Platforms Tested: CFMX7
Total Views: 54,427
Submission Date: October 09, 2006
Last Update Date: June 05, 2009
All Tutorials By This Autor: 10
Discuss This Tutorial
  • This method doesnt seem to work for neither of those formats. It keeps telling me 'Element CHOOSE is undefined in FORM1.' Any idea what could be the problem?

  • hi what should i do for one web form with two diffrent action r two buttons.

  • each row must be a form with a hidden value eg:

    rowidfnlnAction
    123SmithJohn
    124ThomasAlbert

  • How would you pass a hidden value if each row was a unique value?

    rowidfnlnAction
    123SmithJohn
    124ThomasAlbert

Advertisement

Sponsored By...
Powered By...