View file has a js function "confirm_result()" in <head> section: <script type="text/javascript"> function confirm_action() { result = confirm("Please select OK or Cancel") if (result == true) document.write("You selected OK.") else document.write("You selected Cancel.") } </script> The <body> section has <input type="button" onclick="confirm_action()" value="Submit"> Works just fine in IE7 and FireFox3. But not in Chrome 1 or Safari 3. In the latter two the confirm box appears, then a new blank page without the "You selected..." text. Js otherwise working fine Has anyone else encountered this? Bug in Rails? Chrome? Safari? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
this obviously ain''t a bug in rails, as there is not a single line of ruby/rails-code involved. why it won''t work in chrome or safari i cannot say. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ken Wagner wrote:> View file has a js function "confirm_result()" in <head> section: > > <script type="text/javascript"> > function confirm_action() > { > result = confirm("Please select OK or Cancel") > if (result == true) > document.write("You selected OK.") > else > document.write("You selected Cancel.") > } > </script> > > The <body> section has > > <input type="button" onclick="confirm_action()" value="Submit"> > > Works just fine in IE7 and FireFox3. > > But not in Chrome 1 or Safari 3. In the latter two the confirm box > appears, then a new blank page without the "You selected..." text. Js > otherwise working fine > > > Has anyone else encountered this? Bug in Rails? Chrome? Safari?Is this written in RoR? If it is the form helper has an :onsubmit attribute that could be useed to call that JavaScript function and I would be willing to bet that it would work then. I have had issues with Safari and Chrome as well but not concerning forms and JavaScript popups. A quick search led me to this site which shows how to use the :onsubmit attribute: http://railsforum.com/viewtopic.php?id=19539 Good luck, -S -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tried the "onsubmit". Didn''t help. I think it''s a bug in both Google Chrome and Safari. Anyone else encountered the same thing? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Tried the "onsubmit". > > Didn''t help. > > I think it''s a bug in both Google Chrome and Safari. > > Anyone else encountered the same thing?https://bugs.webkit.org/show_bug.cgi?id=8961 https://bugs.webkit.org/show_bug.cgi?id=14709 Are you sure you want to use document.write instead of some DOM manipulation? Regards, Rimantas -- http://rimantas.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I ran into this same issue, it has nothing to do with Rails. This looks to be an issue with the way WebKit (used by Safari and Chrome) handles javascript and form submits. Looks like if there is a onclick on a submit button, data from the form is not submitted when the page is posted. On Dec 24 2008, 2:49 am, Ken Wagner <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> View file has a js function "confirm_result()" in <head> section: > > <script type="text/javascript"> > function confirm_action() > { > result = confirm("Please select OK or Cancel") > if (result == true) > document.write("You selected OK.") > else > document.write("You selected Cancel.") > } > </script> > > The <body> section has > > <input type="button" onclick="confirm_action()" value="Submit"> > > Works just fine in IE7 and FireFox3. > > But not in Chrome 1 or Safari 3. In the latter two the confirm box > appears, then a new blank page without the "You selected..." text. Js > otherwise working fine > > Has anyone else encountered this? Bug in Rails? Chrome? Safari? > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---