开发者

Form validation fails but submits page

I have a form which uses GET as the method. I want to do some js validation on the form. I bind the event using

document.forms[0].onsubmit = function(){return myObj.myFrm.isFormValid();}. 

In Firefox it works the first time I click on submit but after a while if I click it again the form submits even though I've not changed 开发者_Python百科and data.

Any ideas?


Simply adding an event handler doesn't stop it from submitting.

You need to add in preventDefault();

(Documentation)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜