I think I dropped the token and it fell into the ether... (update)

Dec 23, 2004 12:04

Normally, I'd just ask this on the BBS, but this gives me the opportunity to get input from a much wider range of people.

I've got a problem with an HTML form that makes use of javascript. Most of the time, it works great. But very occasionally, it causes the form to be submitted twice.

I'm using a submit button and an onSubmit event handler on the 'form' tag. The onSubmit looks like this:

onSubmit="if (!field_edits()) {return false} else {value='Please wait...'; document.getElementById('Submit_Button').disabled = true; document.getElementById('Reset_Button').disabled = true; submit();return false};"

I'm already aware the the "value='Please wait...';" part is a mistake and needs to be removed, but it doesn't seem to be causing errors on my system. The field_edits() call appears to be working correctly and prevents the submit when the things it checks are wrong. My guess is that it's because I'm manually calling submit() and then returning false to the onSubmit handler (preventing it from doing its own submit). But everything I've read about the submit() method says that it does not call the onSubmit handler, so it's not because it's looping through that event handler. Unless IE 6.0 doesn't work the way I expect it to.

Is anyone out there able to tell me, fairly definitively, whether removing the submit() call and changing the return to true will fix the problem I'm seeing?

UPDATE - Well, it seems that it's not the web page that's submitting the form twice--it's the USER. I should have known. Admittedly, they're submitting the form again because of an error, but the error is completely unrelated to the javascript.
Previous post Next post
Up