View Full Version : Submitting a form with Javascript

10-10-2008, 02:36 PM

I've currently got a form setup like so...

<form method="POST" action="/hr/index.php?div=24&admin=add" name="hr" enctype="multipart/form-data">
<input type="submit" name="submit" value="Save Changes" />

I've got some Javascript assigned to a span, with this code:

Yet for some reason it's not working, and throws up errors:
IE7: "Object doesn't support this property or method"
FF3: "document.hr.submit is not a function" (Firebug)

Any idea what I'm doing wrong please? I'm really a bit confused by this :/

10-10-2008, 03:18 PM
Yes, hr.submit refers to the form element having name="submit".
Change that name to something else, "submit1"

10-10-2008, 04:11 PM
Blimey, I never would of expected that - many thanks for the fix and explanation, really appreciate it :thumbsup:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum