Home » Tutorial

Javascript Submit Form Not Working

Written By: techieDan on November 26, 2009 One Comment

Remember previously I was writing about how to do javascript to submit a form in html/jsp/php/asp. Well, surprisingly sometimes we discover things which are unexpected. For instance to submit a form without clicking the submit button but another link or button. Though something is wrong! The form doesn’t submit at all and there’s a javascript error too.

From the example above, imagine clicking the Send Data button to submit the form using javascript. (Well, the above is just an example and doesn’t do a thing though). The issue is what’s the matter? Here are the solutions.

Submit Form

If you have a submit button visible in your form, do rename your Submit button. For example

<input type="Submit" name="submit" value="submit">

should be renamed to something like

<input type="Submit" name="SendForm" value="submit">

Notice the difference? The name is change in the property of the input type. Now how do you explain this phenomena?

This is a naming issue. forms have a method called ’submit’, but if you give a form element the name ’submit’ then javascript will not be able to find the .submit method, causing your .submit function to never fire.

Finally all is well once again. If you’re still clueless as to how to create a form using buttons and submitting it via javascript, remember to visit this post to learn all about it.

Related Posts with Thumbnails

Tags: , , ,

Digg this!Add to del.icio.us!Stumble this!Add to Techorati!Share on Facebook!Seed Newsvine!Reddit!Add to Yahoo!

One Response to “Javascript Submit Form Not Working”

  1. sportifs says on: 12 December 2009 at 5:18 am

    Well, the article is really the greatest on this laudable topic. I harmonise with your conclusions and will eagerly look forward to your next updates. Saying thanks will not just be adequate, for the phenomenal lucidity in your writing. I will directly grab your rss feed to stay informed of any updates. Fabulous work and much success in yourbusiness enterprize!

Leave a Reply:

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  Copyright © 2009 TechieDan, All rights reserved.| Powered by WordPress