using play framework can create form user can fill out , submit, bringing javascript confirmation popup disappears after second, , doesn't refresh page. shown in video: https://www.youtube.com/watch?v=serfqiifhki
however, can't seem replicate in rails. i've tried using
<%= form_tag "/", :autocomplete => :off, :name => 'sentmessage', :remote => 'true', :id => 'contactform', :authenticity_token => true, :method => 'post' %> and in routes.rb
post '/' => 'home#submit_contact' finally, in home_controller.rb
def submit_contact redirect_to '#contact' end and bring javascript confirmation popup, refresh page not want! there way replicate shown in video in rails?
since form remote form action should respond js / json response, rather redirecting new action
you can add these lines in controller action , define corresponding js template (submit_contact.js.erb file)
respond_to |format| format.js end in js template can write javascript code.
Comments
Post a Comment