For some reason the submit button on a search widget wasn’t submitting under Safari. It works totally fine in the other browsers, but Safari? nothing.
Hmm. The onsubmit event wasn’t even getting called. You click the button, and nothing.
Is it one of the annoying bugs to do with naming the submit button or something lame like that?
Nope, this one turned out to be due to an event handler placed on the body element:
document.getElementsByTagName(”body”).item(0).onclick = function() {}
Safari would take this click and call this function, and wouldn’t run the click event that the submit button has intrinsically.
Of course, the line of code above didn’t actually exist, it was created via the myriad of JavaScript libraries that this web application was using.
April 24th, 2006 at 1:44 pm
So what’s the correct behavior? Should handled events be cascaded to underlying components? I kinda doubt it in general, maybe this is some sort of workaround?
July 7th, 2008 at 3:41 pm
I am writing this in July 2008. Has no one figured a solution for this problem yet? I encountered it today on the latest version of Safari and need to fix it ASAP!
August 29th, 2008 at 7:30 am
I found one more bug according mouse events and submit button (and also button element similar).
Problem is about mouse position detection, if you attach onclick event which detects mouse position to the input=submit element, then y coordinate is incorect, nothing similar if you do this for example with div onclick event.
function mouseCoordinates(e) {
var pos_1=pos_2=0;
if (!e)
var e=window.event;
if (e.pageX || e.pageY) {
pos_1=e.pageX;
pos_2=e.pageY;
} else if (e.clientX || e.clientY) {
pos_1=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
pos_2=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;
}
return [pos_1, pos_2];
}
September 17th, 2008 at 10:17 am
I was struggling with a similar problem with onSubmit and Safari — worked fine in PC browsers, essentially submitting text into its own javascript environment — but not in Safari, where it would perform its task, and then go on to reload the page, which I didn’t want it to do. Also very odd results in Opera on the Mac.
I realized that I hadn’t added “return=false;” to the javascript onSubmit:
<form onSubmit=”ExtraText(); return false;”….
Problem solved, for me. As a friend said, “different levels of prissiness in browsers.”
October 16th, 2008 at 2:12 am
Struggling with submit button in Safari. though working fine in other browsers.
Code as follows in jsp:
Kindly give me the the code so that i can try in safari