diff --git a/application/views/addemployee.php b/application/views/addemployee.php index 71617098..b4df15e6 100644 --- a/application/views/addemployee.php +++ b/application/views/addemployee.php @@ -19,6 +19,9 @@ $(function(){ $('#permanentaddress').val($('#currentaddress').val()); }); }); + + + function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : evt.keyCode; @@ -51,7 +54,48 @@ function validatePAN() { } function Validate() { - + if($("#FirstName").val().length < 1) + { + alert('Please Enter FirstName'); + return; + } + if($("#LastName").val().length < 1) + { + alert('Please Enter LastName'); + return; + } + if($("#FatherName").val().length < 1) + { + alert('Please Enter FatherName'); + return; + } + if($("#DateofBirth").val().length < 1) + { + alert('Please Enter Date of Birth'); + return; + } + if ( $('#ContactNumber').val().length < 1 ) + { + alert('Please Enter Contact Number'); + return; + } + else if(!getMobileValidation()) + { return;} + + + + + if($("#emailid").val().length < 1) + { + alert('Please Enter Email ID'); + return; + } + else if(!validateEmail()) + { + return; + } + + if($("option:selected", $("#gender")).val() == '-1') { alert('Please Select Gender'); @@ -69,6 +113,30 @@ function Validate() alert('Please Select Blood group '); return; } + if($("#currentaddress").val().length < 1) + { + alert('Please Enter Current Address'); + return; + } + if($("#permanentaddress").val().length < 1) + { + alert('Please Enter Permanent Address'); + return; + } + if($("#emergencycontactname").val().length < 1) + { + alert('Please Enter Emergency Contact Name'); + return; + } + if($("#emergencycontactnumber").val().length < 1) + { + alert('Please Enter Emergency Contact Number'); + return; + } + else if(!getValidEmergencyNumber()) + { return;} + + if($("option:selected", $("#desigination")).val() == "-1") { alert('Please Select Desigination '); @@ -84,15 +152,18 @@ function Validate() alert('Please Select Qualification'); return; } - if(!validateEmail()) - { - alert('Please Enter Valid Email Address'); - return ; - } - getMobileValidation(); - getValidEmergencyNumber(); - getValidReferNumber(); + if($("#referrercontno").val().length > 0) + { + getValidReferNumber(); + } + + if($("#passportno").val().length > 1) + { + ValidatePassport(); + + } + } function getMobileValidation() { var contactNumber = $('#ContactNumber').val().length; @@ -108,7 +179,7 @@ function getMobileValidation() { } function getValidEmergencyNumber() { var contactNumber = $('#emergencycontactnumber').val().length; - if(contactNumber > 0 && contactNumber < 10) + if(contactNumber < 10) { alert('Please Enter valid Emergency Contact Number'); return false; @@ -147,11 +218,7 @@ function validateEmail() { return true; } } - else - { - alert('Please Enter Email Address'); - return (false); - } + } function getAge() { @@ -202,6 +269,19 @@ function resetphoto() $("#photo").src(""); } +function ValidatePassport() +{ + var regsaid = /^[A-PR-WY][1-9]\d\s?\d{4}[1-9]$/ig; + var passport = $("#passportno").val(); + //alert(passport); + if(regsaid.test(passport) == false) + { + alert('You have entered invalid Passport.'); + return; + } + +} +