Wednesday, April 01, 2009

Troubles calling form.submit()

Apparently you can't have an element with an id of submit in a form and call form.submit()

It will try calling that element as a function rather than invoking the form.submit method


<form onsubmit="agree();return false;">



<div class="buttons">

<input type="submit" name="iAgree" id="iAgree" value="I Agree" class="button" />

<input type="button" name="disAgree" id="disAgree" value="Cancel" class="button" onClick="tb_remove();" />

</div>

</form>
agree is not a function
<input type="submit" name="agree" id="agree" value="I Agree" class="button" />

so if the form has an element named agree
agree is not a valid function name in the onsubmit
weird

Your comments Here! Hover Your cursor to leave a comment.