Odd js behavior in Chrome & Safari


#1

View file has a js function “confirm_result()” in section:

The section has

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?


#2

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.


#3

Ken W. wrote:

View file has a js function “confirm_result()” in section:

The section has

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


#4

Tried the “onsubmit”.

Didn’t help.

I think it’s a bug in both Google Chrome and Safari.

Anyone else encountered the same thing?


#5

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/


#6

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 W. removed_email_address@domain.invalid