I have a form that submits to an action page that inserts/updates a database table depending on which button was pressed. How can I determine from the form which button was pressed?
Thank you for responding. That is exactly what I am trying to do. I was trying by testing for whether the value was true or not. Like this....
<cfif FORM.update>
<!--- Run update query --->
<cfelseif FORM.delete>
<!--- Run delete query --->
</cfif>
After fixing this problem another one arose. The form page has the submit buttons as images. So in the form the buttons look like this....
<input type="Image" name="update" src="images/update.gif">
<input type="Image" name="delete" src="images/delete.gif">
Is there a way to find out which image was pressed?
To see if the user clicked a particular image submit button, use:
<CFIF IsDefined("FORM.update.x") OR IsDefined("FORM.update.y")>
...update statements go here... <CFIF IsDefined("FORM.delete.x") OR IsDefined("FORM.delete.y")>
...delete statements go here... </CFIF>
The x and y represent the Cartesian pixel coordinates within the image that the user clicked. So, Theoretically, you could have several actions based on the exact pixel the user clicked. - tleish
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.