Consider the following simple html code
The above code displays a simple page with a text box a "submit" button and a "submit" link. Seeing the code one can understand that a form will be submitted whenever the click on the submit button or submit link.
PROBLEM:
Hold on, just try the above example if you click on the "submit" button your form will be submitted without any problem and tries to display "test2.html" however if you click on the "submit" link the form will not be submitted and it will remain in the same page. SURPRISING and WHY?
CAUSE:
document.forms[0].submit() method will not work if any of the form elements are named as "submit". Strange but true.
Solution:
Use document.forms[0].submit.click(); method to invoke the submit button click event which will have the form to be submitted.
Hope this is useful to you all because everyone uses the above type of code. It almost took me a day to identify the real cause pf the problem
Monday, November 16, 2009
Friday, November 13, 2009
Subscribe to:
Posts (Atom)

