Skip to main content

Posts

Showing posts with the label jQuery Validation

How to add Validation rule in jQuery validation Plugin

How to add Validation rule in jQuery validation Plugin 1. Load the validate plugins <script src="js/jquery.validate.js"></script> 2. Now call the jQuery validate method <script> $(document).ready(function(){ // Add your own custom method  $("#old_password").rules('add',{remote:"check_password.php",  messages: {remote: "Passwords do not match"}});  $("#confirm_password").rules('add',{equalTo: "#password",   messages: {equalTo: "New password and confirm password do not match"}}); }); controller action $count=$this->Member->find('count',array( 'conditions'=>array('Member.password'=>md5($_GET['oldPass']), 'Member.id'=>$this->Session->read('Member.id'))));    if($count>0)    { echo 'true'; die;    } else { echo 'false'; die;   } // valid...

How to validate form using jQuery without plugin and submitHandler method

How to validate form using jQuery without plugin and submitHandler method  Include jQuery validate library i.e  jquery.validate.js 1.How to ignore title in validation $("#form").validate({ ignoreTitle: true }); OR $('#addUser').validate({ rules: { 'data[Member][password]': {   required: true,  minlength: 6 },   'data[Member][cnf_pass]': {  required: true, equalTo: '#password' }, 'data[Member][contact_no]': {  number: true,  }, messages: {                   "data[Member][contact_no]": {  number: 'Only Numeric Value.'  }              }          }       }); Email validation unique $("#email").rules('add',{remote:ajax_url+'Members/check_email', messages: {remote: "Email address already exist...