jump to navigation

Javascript error: submit is not a function June 26, 2009

Posted by Anoop Somasundaran in Javascript.
Tags:
trackback

You might have got this javascript error when you were trying to submit the form using javascript. When I got this error for the first time it surprised me because I had used submit method many times to submit the form using javascript. This error wasted a couple of hours of mine to find out what was going wrong.

The reason for this error is that you might be using a submit button named ‘submit’ which causes a conflict in javascript since the submit method is already bound to that button.

<input name="submit" type="submit" value="download" />
Or
<html:submit property="submit"/> in struts form.

Changing the name of the button to anything other that submit will solve the problem and submit() call in your javascript will now work.

<input name="download" type="submit" value="download" />

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: