diff --git a/application/views/AddEmp.php b/application/views/AddEmp.php index ce36592..95116bf 100644 --- a/application/views/AddEmp.php +++ b/application/views/AddEmp.php @@ -26,28 +26,30 @@ oFReader.onload = function (oFREvent) { document.getElementById("uploadPreview").src = oFREvent.target.result; }; - }; -function checkno_if_exists() { - - var mobile_no = $("#mno").val(); - $('#mobErr').hide(); + }; +//do not delete this part -$.ajax({ - type:"post", - url: "EmployeeController/mno_validation", - data:{ mobile_no:mobile_no}, - success:function(response) - { +// function checkno_if_exists() { + +// var mobile_no = $("#mno").val(); +// $('#mobErr').hide(); + +// $.ajax({ +// type:"post", +// url: "EmployeeController/mno_validation", +// data:{ mobile_no:mobile_no}, +// success:function(response) +// { - if (response == true) - { - $('#mobErr').show(); - $('#mobErr').html("This mobile number already exists"); - $("#mno").val(''); - } - } - }); -} +// if (response == true) +// { +// $('#mobErr').show(); +// $('#mobErr').html("This mobile number already exists"); +// $("#mno").val(''); +// } +// } +// }); +// } @@ -209,6 +211,27 @@ if (companyName == '') { } +function validateKeyPress(event) { + var key = event.key; + var allowedCharacters = /^[A-Za-z._/-]$/; + + if (!allowedCharacters.test(key)) { + event.preventDefault(); + } +} + +function validateName(event) { + const charCode = event.which || event.keyCode; + const char = String.fromCharCode(charCode); + + // Regular expression to match alphanumeric characters + const regex = /^[a-zA-Z0-9_-]*$/; + + if (!regex.test(char)) { + event.preventDefault(); + return false; + } +} @@ -254,27 +277,27 @@ if (companyName == '') {