Monday, 26 March 2018

Aui validation for Pancard & Passport & Aadhar Validations

1] Remove Aui type submit
2] Inside input Add Class
<p id="id"></p>

<aui:button value="Save"  onClick="submitFormsss();"/>

<script type="text/javascript">
   function submitFormsss() {
   var panVal = $('.panNumber').val();
   var passVal = $('.passNumber').val();
   var aadharVal = $('.aadhar').val();
   var regpan = /^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/;
   var regpassport = /^([a-zA-Z]){1}([0-9]){7}?$/;
   var regaadhar = /^([0-9]){12}?$/;
 
   if(regpan.test(panVal) && regpassport.test(passVal) && regaadhar.test(aadharVal)){
       document.<portlet:namespace />fm.submit();
   }else if(!regpan.test(panVal)){
       alert("Please enter valid Pan number")
       document.getElementById("pan").innerHTML = "Please Provide Valid Pan Number";
   }else if(!regpassport.test(passVal)){
   document.getElementById("pass").innerHTML = "Please Provide Valid Passport Number";
   }else if(!regaadhar.test(aadharVal)){
   document.getElementById("aadhar").innerHTML = "Please Provide Valid Aadhar Number";
   }
   }
</script>

No comments:

Post a Comment