rails ajax form cancel link get rid of form

204 views Asked by At

If im using Ajax to render a form into a DOM element on my page, how would I handle cancel link behavior?

Assuming I have <%= f.submit %> at the bottom of the form, what would I use for a cancel link next to it?

The ideal would be to get rid of the form without submitting or redirecting.

1

There are 1 answers

0
Stanislav Mekhonoshin On BEST ANSWER

Use whatever you prefer.

= link_to 'Cancel', '#', class: 'cancel-link'

or

= button_to 'Cancel', '#', class: 'cancel-link'