Rails check a form is edited and let user confirm page redirection or close -



Rails check a form is edited and let user confirm page redirection or close -

form posting mutual operation on web site, , improve user experience, need prevent user mistaken close window or click wrong link, page :)

so there standard way or gem in rails?

var edited = false; $('#formid :input').change(function() { if(!edited) { edited = true; } }); window.onbeforeunload = preventuser(); function preventuser() { if(edited) { alert("are sure?"); } }

ruby-on-rails

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -