ajax - why is javascript validation not working? -
i using next code validate user data:
'#calculate' : { onclick : function(evt) { evt.preventdefault(); var errorcode = 0; if(document.getelementbyid('zip').value == ''){ dojo.query("#zipvalidate").addclass("error"); errorcode = 1; dojo.place('<div class="icon"></div>',dojo.byid('zip'),'after'); } else { dojo.query("#zipvalidate").removeclass("error"); errorcode = 0; } if(errorcode == 0) { validation passed , phone call ajax } } }
but if validation fails, still goes ajax call.
i tried removing global errorcode
too, still have same issue.
javascript ajax dojo
No comments:
Post a Comment