JavaScript Auto Submit Form, Why Firefox!? Why!?

Associate
Joined
7 Oct 2003
Posts
674
Location
Bournemouth
Hi guys,

I have written an application in ASP, options are returned from a database; if there are multiple options you need to select a radio and continue.

if there is only one option, the form should be auto submitted. the form ID is 'autoform' for this example

Code:
<SCRIPT>autoform.submit();</SCRIPT>
Works in IE7, IE8, Chrome and Opera. But not firefox.

Any idea why its not happy? or what i can use. any ideas appreciated.
 
After a good hour, ive finally found this out. how annoying....

Code:
document.autoform.submit();
where "autoform" is the same as the form's "name" attribute.

OR

Code:
document.getElementById('autoform').submit();
where "autoform" is the same as the form's "id" attribute.


so remember if you are using NAME or ID to define your forms/HTML in general... Firefox requires different syntax either way.

man, that sucks!
 
No, in this case Firefox is right, the others were being too lax :)

indeed, its a learning curve, one to remember and make things more clompliant in future. im suprised that chrome and opera (especially opera) to accept it
 
I would imagine they do because Microsoft started tolerating non-standards compliant code back in IE5 days, and because of that most modern browser engines still do too to make sure that sites don't get broken.
 
Back
Top Bottom