user984621
user984621

Reputation: 48521

Rails - form_tag with :remote => true and false

I have a form with :remote => true, where is button and submit_tag for sending form. When I send form through button, I would need to send the form as :remote => true and render some data through AJAX, which works me well.

But if a user send form through the submit_tag, I would need to execute some operations and then redirect_to an another page.

Is there any way, how to do it with :remote => true in the form head?

Thanks

Upvotes: 1

Views: 1439

Answers (2)

user984621
user984621

Reputation: 48521

Ok, so this is how I have solved it:

render js: %(window.location.href='#{root_url}')

Upvotes: 1

azaytc
azaytc

Reputation: 63

Try to use jsvascript. Add remote attribute to form dynamically on button click.

Upvotes: 0

Related Questions