does the page where it fails validate from 3ws validate ? it seems to me if the validation code works on a similar page then the problem is not with the validation code. Also does the error console give you any errors ?
MM On May 11, 3:08 pm, Krish <senthil....@gmail.com> wrote: > Hey mike, > > Thanks for your quick response. but still its not working for me... > > i tried the same code in a another similar form. its working well > there. but when i execute the same code in this page, its not > executing. > > any idea to resolve this would help me a lot... > > Thanks, > Krish > > On May 11, 11:32 am, Mean Mike <mcgra...@gmail.com> wrote: > > > according to the documentation "messages" is a property of the rule > > not a method seehttp://docs.jquery.com/Plugins/Validation/rules > > > I adjusted your code to reflect that see if that makes it any better > > > mysite.validateFormFields = function() { > > > alert('here'); > > // its hitting here > > // validate contact form on keyup and submit > > $("#myForm").validate({ > > alert('here'); > > // its not hitting here[/b][/color] > > . / set the rules > > for the field names > > onkeyup: false, > > rules: { > > > fname: { > > required: true, > > minlength: 2, > > maxlength: 20, > > validChars: true, > > nameCheck: true, > > messages: { > > required: "Please enter first > > name", > > minlength: jQuery.format("First > > name must be at least{0} > > characters in length."), > > maxlength: jQuery.format("First > > name can not exceed {0} > > characters in length."), > > validChars: "please supply valid > > characters only.", > > nameCheck: "Please enter first > > name" > > } > > }, > > > lname: { > > required: false, > > minlength: 0, > > validChars: true, > > nameCheck: true, > > messages: { > > //required : "Please enter your last name", > > validChars: "please supply valid characters only.", > > nameCheck: "Please enter last name" > > } > > } > > } > > }); > > // end of validate > > > } > > > $.validator.addMethod('nameCheck', function(value) { > > if (value == '1st Name' || value == 'Surname') { > > //alert('here in if'); > > return false; > > } else { > > //alert(value); > > //alert('here in else'); > > return true; > > } > > > },''); > > > $.validator.addMethod('validChars', function(value) { > > var iChars = "!...@#$%^&()+=[]\\\';,./{}|\"<>?"; > > > for (var i = 0; i < value.length; i++) { > > if (iChars.indexOf(value.charAt(i)) != -1) { > > return false; > > } > > } > > return true; > > > },''); > > > Mean Mike