I’m stuck in a problem, I’ve tried to solve this from last week and I
still can’t achieve it.
I have a Form in my rails 3.0.9 app to “accept” or “reject” a
document, untill now I’m using a collection select with two options
“Accept” and “Reject”, then I have to click on the submit button to
save changes.
What I want to do now is, instead of the collection select I want to
have two buttons, one named “accept” and the other named “reject” and
when the user click one of the buttons, save the changes inmediately.
Does anyone know how can I do this?? (I’ve tried with “button_to”, but
I don’t know how to change the value of the attribute). Thanks
What I want to do now is, instead of the collection select I want to
have two buttons, one named “accept” and the other named “reject” and
when the user click one of the buttons, save the changes inmediately.
Does anyone know how can I do this?? (I’ve tried with “button_to”, but
I don’t know how to change the value of the attribute). Thanks
In the Form, you can set two buttons with a different text
Accept
Reject
I presume that could be
submit_tag(“Accept”)
submit_tag(“Reject”)
with the appropriate html around it.
Then when the user clicks one of the two buttons, you will get a POST
request that will contain params and one of the params will have the key
“commit”