How will i have a form having more than one submit buttons..? And how will i know in the controller's action that which submit button is clicked..?
A:
You can set various values of your submit buttons, so you will know which one was submitted. Like this:
<input type="submit" name="submit_btn" value="First submit" />
<input type="submit" name="submit_btn" value="Second submit" />
After that, check on the server-side when submit_btn
equals "First submit" or "Second submit":
if params["submit_btn"] == "First submit"
#Actions
else
#Other actions
end
floatless
2010-08-25 10:39:54
thnx for your help... BUT one thing is there that why it always get into the first condition..?
Jamal Abdul Nasir
2010-08-25 11:18:53
Try to write `params["submit_btn"]` instead of `params[:submit_btn]`. Try also to debug your action by using `p params`, maybe.
floatless
2010-08-25 11:58:33