0

Hi,

I am new to ColdFusion , so i need so help from all....

I am going to do a form having multiple submit buttons in it .
So how can i know which button was clicked. according to this i want different work...

Like simple i want to do add, sub, mul and div in one form.
I have used 4 submit buttons for this after submiting the page i want to reload that page and do accordingly which button was clicked.

So how can i know which button was clicked.
Please respond me...
Thanks

Ashish

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by aksahoo17
0
<cfif StructKeyExists(form,"submit0">
 //logic here
</cfif>

<cfif StructKeyExists(form,"submit1">
 //logic here
</cfif>

<cfif StructKeyExists(form,"submit2">
 //logic here
</cfif>

<cfif StructKeyExists(form,"submit3">
 //logic here
</cfif>

<input type="submit" name="submit0" value="submit0" />
<input type="submit" name="submit1" value="submit1" />
<input type="submit" name="submit2" value="submit2" />
<input type="submit" name="submit3" value="submit3" />

Try that out?

Edited by cfwebdeveloper: n/a

0

So how can i know which button was clicked.

Only the button clicked will exist on the action page. If all 4 buttons share the same name, use the button value ie #form.submitButton#

ie

<cfparam name="form.submitButton" default="">
<!--- display selection --->
<cfdump var="#form#">

<form method="post">
<input type="submit" name="submitButton" value="add" />
<input type="submit" name="submitButton" value="divide" />
<input type="submit" name="submitButton" value="multiply" />
<input type="submit" name="submitButton" value="divide" />
</form>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.