MERGE_TEST_FORM_VALIDATION2
This commit is contained in:
commit
985f25628f
@ -992,7 +992,7 @@ class ClientController extends AdminController
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]|min_length[2]|max_length[45]',
|
||||
'errors' => [
|
||||
'required' => 'Client Name is required',
|
||||
'regex_match' => 'Client Name can only contain letters, numbers, spaces, hyphens(-) and underscores(_).',
|
||||
'regex_match' => 'Client Name can only contain letters, numbers, spaces, hyphens and underscores.',
|
||||
'min_length' => 'Client Name must be at least 2 characters.',
|
||||
'max_length' => 'Client Name must not exceed 45 characters.',
|
||||
]
|
||||
@ -1001,7 +1001,7 @@ class ClientController extends AdminController
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]|min_length[2]|max_length[15]',
|
||||
'errors' => [
|
||||
'required' => 'Client Short Name is required',
|
||||
'regex_match' => 'Client Short Name can only contain letters, numbers, hyphens(-) and underscores(_).',
|
||||
'regex_match' => 'Client Short Name can only contain letters, numbers, hyphens and underscores.',
|
||||
'min_length' => 'Client Short Name must be at least 2 characters.',
|
||||
'max_length' => 'Client Short Name must not exceed 15 characters.',
|
||||
]
|
||||
@ -1019,21 +1019,30 @@ class ClientController extends AdminController
|
||||
'required' => 'HR File Processed By is required.',
|
||||
]
|
||||
],
|
||||
// 'client_logo' => [
|
||||
// 'rules' => [
|
||||
// 'uploaded[client_logo]', // Add this to check if a file was actually sent
|
||||
// 'is_image[client_logo]',
|
||||
// 'max_size[client_logo,200]',
|
||||
// 'ext_in[client_logo,jpg,jpeg,png]',
|
||||
// 'max_dims[client_logo,100,100]',
|
||||
// ],
|
||||
// 'errors' => [
|
||||
// 'uploaded' => 'Please upload a client logo',
|
||||
// 'is_image' => 'The uploaded file must be an image',
|
||||
// 'max_size' => 'File size should not exceed 200 KB',
|
||||
// 'ext_in' => 'Allowed file types: jpg, jpeg, png',
|
||||
// 'max_dims' => 'Image dimensions must be 100 x 100 pixels',
|
||||
// ]
|
||||
// ],
|
||||
'client_logo' => [
|
||||
'rules' => [
|
||||
'uploaded[client_logo]', // Add this to check if a file was actually sent
|
||||
'is_image[client_logo]',
|
||||
'max_size[client_logo,200]',
|
||||
'ext_in[client_logo,jpg,jpeg,png]',
|
||||
'max_dims[client_logo,100,100]',
|
||||
],
|
||||
'errors' => [
|
||||
'uploaded' => 'Please upload a client logo',
|
||||
'is_image' => 'The uploaded file must be an image',
|
||||
'max_size' => 'File size should not exceed 200 KB',
|
||||
'ext_in' => 'Allowed file types: jpg, jpeg, png',
|
||||
'max_dims' => 'Image dimensions must be 100 x 100 pixels',
|
||||
]
|
||||
'rules' => 'permit_empty|is_image[client_logo]|max_size[client_logo,200]|ext_in[client_logo,jpg,jpeg,png]|max_dims[client_logo,100,100]',
|
||||
'errors' => [
|
||||
'is_image' => 'The uploaded file must be an image',
|
||||
'max_size' => 'File size should not exceed 200 KB',
|
||||
'ext_in' => 'Allowed file types: jpg, jpeg, png',
|
||||
'max_dims' => 'Image dimensions must be 100 x 100 pixels',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
@ -1086,6 +1095,65 @@ class ClientController extends AdminController
|
||||
|
||||
public function editClientGeneralInfo()
|
||||
{
|
||||
$rules = [
|
||||
'entity_type_id' => [
|
||||
'rules' => 'required|numeric',
|
||||
'errors' => [
|
||||
'required' => 'Entity Type is required',
|
||||
'numeric' => 'Invalid Entity Type selected'
|
||||
]
|
||||
],
|
||||
'client_name' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Client Name is required',
|
||||
'regex_match' => 'Client Name can only contain letters, numbers, spaces, hyphens and underscores.',
|
||||
'min_length' => 'Client Name must be at least 2 characters.',
|
||||
'max_length' => 'Client Name must not exceed 45 characters.',
|
||||
]
|
||||
],
|
||||
'short_name' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Client Short Name is required',
|
||||
'regex_match' => 'Client Short Name can only contain letters, numbers, hyphens and underscores.',
|
||||
'min_length' => 'Client Short Name must be at least 2 characters.',
|
||||
'max_length' => 'Client Short Name must not exceed 15 characters.',
|
||||
]
|
||||
],
|
||||
'pan' => [
|
||||
'rules' => 'required|regex_match[/^[A-Z]{5}[0-9]{4}[A-Z]$/]',
|
||||
'errors' => [
|
||||
'required' => 'PAN Number is required.',
|
||||
'regex_match' => 'Invalid PAN format. Example: ABCDE1234F'
|
||||
]
|
||||
],
|
||||
'hr_file_processed_by' => [
|
||||
'rules' => 'required',
|
||||
'errors' => [
|
||||
'required' => 'HR File Processed By is required.',
|
||||
]
|
||||
],
|
||||
'client_logo' => [
|
||||
'rules' => 'permit_empty|is_image[client_logo]|max_size[client_logo,200]|ext_in[client_logo,jpg,jpeg,png]|max_dims[client_logo,100,100]',
|
||||
'errors' => [
|
||||
'is_image' => 'The uploaded file must be an image',
|
||||
'max_size' => 'File size should not exceed 200 KB',
|
||||
'ext_in' => 'Allowed file types: jpg, jpeg, png',
|
||||
'max_dims' => 'Image dimensions must be 100 x 100 pixels',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
if (!$this->validate($rules)) {
|
||||
return $this->response->setStatusCode(400)->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Input validation failed',
|
||||
'code' => 400,
|
||||
'errors' => $this->validator->getErrors()
|
||||
]);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'edit client general info function called');
|
||||
$uploadFilePath = ROOTPATH . 'public/uploads/logo/';
|
||||
$file_name = file_Upload($this->request->getFile('client_logo'), $uploadFilePath);
|
||||
@ -1568,14 +1636,14 @@ class ClientController extends AdminController
|
||||
]
|
||||
],
|
||||
];
|
||||
if (!$this->validate($rules)) {
|
||||
return $this->response->setStatusCode(400)->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Input validation failed',
|
||||
'code' => 400,
|
||||
'errors' => $this->validator->getErrors()
|
||||
]);
|
||||
}
|
||||
// if (!$this->validate($rules)) {
|
||||
// return $this->response->setStatusCode(400)->setJSON([
|
||||
// 'status' => false,
|
||||
// 'message' => 'Input validation failed',
|
||||
// 'code' => 400,
|
||||
// 'errors' => $this->validator->getErrors()
|
||||
// ]);
|
||||
// }
|
||||
|
||||
$data['client_id'] = $this->request->getPost('client_id');
|
||||
$data['created_by'] = get_session_userid();
|
||||
@ -1738,14 +1806,14 @@ class ClientController extends AdminController
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]|min_length[3]',
|
||||
'errors' => [
|
||||
'required' => 'Branch Name is required',
|
||||
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens(-) and underscores(_).',
|
||||
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens and underscores.',
|
||||
]
|
||||
],
|
||||
'branch_code' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Branch Code is required',
|
||||
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens(-) and underscores(_).',
|
||||
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens and underscores.',
|
||||
]
|
||||
],
|
||||
'address1' => [
|
||||
@ -1757,11 +1825,13 @@ class ClientController extends AdminController
|
||||
],
|
||||
'state' => [
|
||||
'label' => 'State',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'State is required.',
|
||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||
]
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => 'State is required.']
|
||||
// 'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||
// 'errors' => [
|
||||
// 'required' => 'State is required.',
|
||||
// 'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||
// ]
|
||||
],
|
||||
'district' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
|
||||
@ -2142,7 +2212,7 @@ class ClientController extends AdminController
|
||||
'errors' => [
|
||||
'required' => 'Branch Name is required',
|
||||
'min_length' => 'Branch Name must be at least 3 characters long',
|
||||
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens(-) and underscores(_).'
|
||||
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens and underscores.'
|
||||
]
|
||||
],
|
||||
'branch_code' => [
|
||||
@ -2151,7 +2221,7 @@ class ClientController extends AdminController
|
||||
'errors' => [
|
||||
'required' => 'Branch Code is required',
|
||||
'min_length' => 'Branch Code must be at least 2 characters long',
|
||||
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens(-) and underscores(_).'
|
||||
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens and underscores.'
|
||||
]
|
||||
],
|
||||
'address1' => [
|
||||
@ -2162,10 +2232,11 @@ class ClientController extends AdminController
|
||||
],
|
||||
'state' => [
|
||||
'label' => 'State',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||
// 'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||
'rules' => 'required',
|
||||
'errors' => [
|
||||
'required' => 'State is required.',
|
||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||
// 'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'district' => [
|
||||
@ -2201,7 +2272,7 @@ class ClientController extends AdminController
|
||||
'errors' => [
|
||||
'required' => 'Contact name is required',
|
||||
'min_length' => 'Contact name must be at least 3 characters long',
|
||||
'regex_match' => 'Contact name can only contain letters, numbers, spaces, hyphens(-) and underscores(_).'
|
||||
'regex_match' => 'Contact name can only contain letters, numbers, spaces, hyphens and underscores.'
|
||||
]
|
||||
],
|
||||
'designation.*' => [
|
||||
@ -2329,7 +2400,7 @@ class ClientController extends AdminController
|
||||
'errors' => [
|
||||
'required' => 'Branch Name is required',
|
||||
'min_length' => 'Branch Name must be at least 3 characters long',
|
||||
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens(-) and underscores(_).'
|
||||
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens and underscores.'
|
||||
]
|
||||
],
|
||||
'branch_code' => [
|
||||
@ -2338,7 +2409,7 @@ class ClientController extends AdminController
|
||||
'errors' => [
|
||||
'required' => 'Branch Code is required',
|
||||
'min_length' => 'Branch Code must be at least 2 characters long',
|
||||
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens(-) and underscores(_).'
|
||||
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens and underscores.'
|
||||
]
|
||||
],
|
||||
'address1' => [
|
||||
@ -2349,11 +2420,8 @@ class ClientController extends AdminController
|
||||
],
|
||||
'state' => [
|
||||
'label' => 'State',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'State is required.',
|
||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||
]
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => 'State is required.']
|
||||
],
|
||||
'district' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
|
||||
@ -2388,7 +2456,7 @@ class ClientController extends AdminController
|
||||
'errors' => [
|
||||
'required' => 'Contact name is required',
|
||||
'min_length' => 'Contact name must be at least 3 characters long',
|
||||
'regex_match' => 'Contact name can only contain letters, numbers, spaces, hyphens(-) and underscores(_).'
|
||||
'regex_match' => 'Contact name can only contain letters, numbers, spaces, hyphens and underscores.'
|
||||
]
|
||||
],
|
||||
'designation.*' => [
|
||||
|
||||
@ -418,7 +418,7 @@ class LeadsController extends BaseController
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]|min_length[3]',
|
||||
'errors' => [
|
||||
'required' => 'Branch Name is required.',
|
||||
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens(-) and underscores(_)..',
|
||||
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens and underscores..',
|
||||
'min_length' => 'Branch Name must be at least 3 characters long.'
|
||||
]
|
||||
],
|
||||
@ -426,14 +426,14 @@ class LeadsController extends BaseController
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Branch Code is required.',
|
||||
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens(-) and underscores(_)..'
|
||||
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens and underscores..'
|
||||
]
|
||||
],
|
||||
'contact_person_name' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9_ -]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Contact Person Name is required',
|
||||
'regex_match' => 'Contact person name only letters, numbers and spaces, hyphens(-) and underscores(_)..'
|
||||
'regex_match' => 'Contact person name only letters, numbers and spaces, hyphens and underscores..'
|
||||
]
|
||||
],
|
||||
'contact_person_mobile' => [
|
||||
|
||||
@ -1140,7 +1140,7 @@ class TicketController extends BaseController
|
||||
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Employee Code is required.',
|
||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens(-) and underscores(_). allowed).'
|
||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).'
|
||||
]
|
||||
],
|
||||
'emp_name' => [
|
||||
@ -1173,7 +1173,9 @@ class TicketController extends BaseController
|
||||
'regex_match' => 'Policy Number can only contain letters, numbers, spaces, hyphens(-) underscores(_), and slashes(/).'
|
||||
]
|
||||
],
|
||||
'tpa_no' => ['label' => 'TPA ID','rules' => 'permit_empty','errors' => []],
|
||||
'tpa_no' => ['label' => 'TPA ID','rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9]+$/]','errors' => [
|
||||
'regex_match' => 'TPA ID can only contain letters and numbers.'
|
||||
]],
|
||||
'emp_mobile' => ['label' => 'Employee Mobile No','rules' => 'required|numeric|exact_length[10]',
|
||||
'errors' => [
|
||||
'required' => 'Mobile number is required',
|
||||
@ -1189,9 +1191,8 @@ class TicketController extends BaseController
|
||||
]
|
||||
],
|
||||
'emp_personal_mail' => ['label' => 'Personal Mail ID',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
|
||||
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
|
||||
'errors' => [
|
||||
'required' => 'Personal Email address is required.',
|
||||
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
|
||||
]
|
||||
],
|
||||
@ -1335,7 +1336,7 @@ class TicketController extends BaseController
|
||||
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Employee Code is required.',
|
||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens(-) and underscores(_). allowed).',
|
||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
|
||||
]
|
||||
],
|
||||
'emp_name' => [
|
||||
@ -1362,9 +1363,8 @@ class TicketController extends BaseController
|
||||
]
|
||||
],
|
||||
'emp_personal_mail' => ['label' => 'Personal Mail ID',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
|
||||
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
|
||||
'errors' => [
|
||||
'required' => 'Personal Email address is required.',
|
||||
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
|
||||
]
|
||||
],
|
||||
@ -1475,7 +1475,7 @@ class TicketController extends BaseController
|
||||
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Employee Code is required.',
|
||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens(-) and underscores(_). allowed).',
|
||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
|
||||
]
|
||||
],
|
||||
'emp_name' => [
|
||||
@ -1526,9 +1526,8 @@ class TicketController extends BaseController
|
||||
]
|
||||
],
|
||||
'emp_personal_mail' => ['label' => 'Personal Mail ID',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
|
||||
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
|
||||
'errors' => [
|
||||
'required' => 'Personal Email address is required.',
|
||||
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
|
||||
]
|
||||
],
|
||||
@ -1567,35 +1566,6 @@ class TicketController extends BaseController
|
||||
'hospital_pin_code' => ['label' => 'Hospital Pincode','rules' => 'required|numeric|exact_length[6]',
|
||||
'errors' => ['exact_length' => 'Pincode must be 6 digits']
|
||||
],
|
||||
'state' => [
|
||||
'label' => 'State',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'State is required.',
|
||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'district' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'District is required.',
|
||||
'regex_match' => 'District can contain letters, numbers, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'city' => [
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
|
||||
'errors' => [
|
||||
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
|
||||
]
|
||||
],
|
||||
'pincode' => [
|
||||
'rules' => 'required|numeric|exact_length[6]',
|
||||
'errors' => [
|
||||
'required' => 'Pincode is required.',
|
||||
'numeric' => 'Pincode must be digits only.',
|
||||
'exact_length' => 'Pincode must be exactly 6 digits.'
|
||||
]
|
||||
],
|
||||
'hospital_phone_no' => ['label' => 'Hospital Phone','rules' => 'required|numeric|min_length[10]',
|
||||
'errors' => ['min_length' => 'Phone number too short']
|
||||
],
|
||||
@ -1687,7 +1657,7 @@ class TicketController extends BaseController
|
||||
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
|
||||
'errors' => [
|
||||
'required' => 'Employee Code is required.',
|
||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens(-) and underscores(_). allowed).',
|
||||
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
|
||||
]
|
||||
],
|
||||
'emp_name' => [
|
||||
@ -1714,9 +1684,8 @@ class TicketController extends BaseController
|
||||
]
|
||||
],
|
||||
'emp_personal_mail' => ['label' => 'Personal Mail ID',
|
||||
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
|
||||
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
|
||||
'errors' => [
|
||||
'required' => 'Personal Email address is required.',
|
||||
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
|
||||
]
|
||||
],
|
||||
|
||||
@ -383,12 +383,23 @@
|
||||
let $label = $('#employee_data_points_label');
|
||||
let $input = $('#emp_mobile_number_for_claim');
|
||||
|
||||
// Remove old attributes but DO NOT clear the .val()
|
||||
$input.removeAttr('onkeypress maxlength oninput');
|
||||
|
||||
if (value == "mobile") {
|
||||
$label.text('Employee Mobile Number');
|
||||
$input.attr('onkeypress', 'return onlyNumbers(event)').attr('maxlength', '10');
|
||||
|
||||
$input.val($input.val().replace(/[^0-9]/g, '').substring(0, 10));
|
||||
$input.attr('oninput', "this.value = this.value.replace(/[^0-9]/g, '').substring(0, 10)");
|
||||
} else {
|
||||
$label.text('Employee ID');
|
||||
$input.removeAttr('onkeypress maxlength');
|
||||
|
||||
$input.attr('onkeypress', 'return onlyEmployee(event)');
|
||||
$input.val($input.val().replace(/[^a-zA-Z0-9\s\-_/]/g, ''));
|
||||
$input.attr('oninput', "this.value = this.value.replace(/[^a-zA-Z0-9\\s\\-_/]/g, '')");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -1069,6 +1080,24 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
function onlyEmployee(event) {
|
||||
var charCode = (event.which) ? event.which : event.keyCode;
|
||||
|
||||
// Allow Numbers (48-57)
|
||||
// Allow Uppercase (65-90)
|
||||
// Allow Lowercase (97-122)
|
||||
// Allow Space (32), Hyphen (45), Underscore (95), Forward Slash (47)
|
||||
if (
|
||||
(charCode >= 48 && charCode <= 57) ||
|
||||
(charCode >= 65 && charCode <= 90) ||
|
||||
(charCode >= 97 && charCode <= 122) ||
|
||||
[32, 45, 95, 47].includes(charCode)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function setClientPolicyData(input) {
|
||||
|
||||
// console.log('policy_value ',input);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user