I have a case that a form has two submit button,
one is edit button that only change the current div that can use
form_remote_tag,
the other is delete button that should refresh the whole page that can
use
form_tag.
But I what use edit and delete button both in a form, how can I do that?
I have a case that a form has two submit button,
one is edit button that only change the current div that can use
form_remote_tag,
the other is delete button that should refresh the whole page that can use
form_tag.
But I what use edit and delete button both in a form, how can I do that?
–
I think javascript is the only way I can think of.
One way would be to load the page, and then attach an event listener to
the
submit event of the form. Then you detect if it’s an edit click, in
which
case make an ajax request and the stop the event with Event.stop( event
).
If it’s the delete button do nothing and let the form take it’s natural
course.