jquery Validation on Enter key not working -
when use submit button on form validated validation form run expected.
when use enter key instead of submit button validation not work properly.
form gets submitted out checking validation .
how can solve problem ?
$(function () { /* varable declarataion..... */ var $pin = $("#pincode").attr("name"); var $params = {debug:false, rules:{}, messages:{}}; $params['invalidhandler'] = function(form, validator) { jquery(document).scrollleft(300) ; jquery(document).scrolltop(100); var posx = jquery(document).clientwidth/2; var posy = jquery(document).scrolltop()+(jquery(document).clientheight/2); $("#dialog-confirm").dialog({ resizable: false, height:180, modal: true, position:[posx,posy], buttons: { "ok": function() { $( ).dialog( "close" ); } } }); }; $params['rules'][$pin] = {required:true, digits :true, maxlength:9, min:1}; $params['messages'][$pin] = { required:"please enter pin code", digits :"please enter valid pin", maxlength:"pin code must less 10 digit", min: "zero can not pin code" }; $("#form1").validate($params); });
Comments
Post a Comment