FIX_VALIDATION_FORM_JS_FILE

This commit is contained in:
VENKATESHWARAN 2026-04-15 10:01:25 +05:30
parent bdde7bfe82
commit 1f4ff4989d
5 changed files with 33 additions and 82 deletions

View File

@ -159,3 +159,19 @@ bds.dailyReportEmails =
MEDIASSIST_WELLNESS_KEY =
MEDIASSIST_WELLNESS_IV =
MEDIASSIST_WELLNESS_LOGIN_URL =
#--------------------------------------------------------------------
# Icici api details LIVE
#--------------------------------------------------------------------
ICICI_TOKEN_URL =
ICICI_BASE_URL =
ICICI_PASSWORD =
ICICI_CLIENT_ID =
ICICI_CLIENT_SECRET =
ICICI_API_SCOPE =
ICICI_GRANT_TYPE =
ICICI_PRIMARY_KEY_CONSTANT =

View File

@ -180,8 +180,8 @@ if (!function_exists('user_team')) {
function user_team()
{
// $CI =& get_instance();
$session = \Config\Services::session();
return $session->get('user_team');
$session = \Config\Services::session();
return $session->get('user_team') ?: [];
}
}

View File

@ -1,3 +1,7 @@
/**
* Parsley validation for the leads form. Does not strip or rewrite user input;
* invalid values are reported via Parsley messages only.
*/
(function (getJq) {
'use strict';
@ -162,25 +166,6 @@
});
}
function sanitizeOnInput(el) {
if (!el || isSkippableField(el)) {
return;
}
if (isMobileField(el)) {
var clean = (el.value || '').replace(/\D/g, '').substring(0, 10);
if (el.value !== clean) {
el.value = clean;
}
return;
}
if (isCharsetCandidate(el)) {
var raw = el.value || '';
if (!TEXT_ALLOWED.test(raw)) {
el.value = raw.replace(/[^A-Za-z0-9/_.\- ]/g, '');
}
}
}
function refreshParsley($form) {
if (!$form || !$form.length || !isParsleyReady()) {
return;
@ -227,7 +212,6 @@
$form.off(NS);
$form.on('input' + NS, 'input:not([type=hidden]), textarea', function () {
sanitizeOnInput(this);
validateField(this);
});
$form.on('change' + NS, 'select, input:not([type=hidden]), textarea', function () {

View File

@ -1,3 +1,7 @@
/**
* Parsley validation for the new-client modal. Does not strip or rewrite user input;
* invalid values are reported via Parsley messages only.
*/
(function (getJq) {
'use strict';
@ -142,25 +146,6 @@
});
}
function sanitizeOnInput(el) {
if (!el || isSkippable(el)) {
return;
}
if (isMobile(el)) {
var d = (el.value || '').replace(/\D/g, '').substring(0, 10);
if (el.value !== d) {
el.value = d;
}
return;
}
if (isCharsetCandidate(el)) {
var raw = el.value || '';
if (!TEXT_ALLOWED.test(raw)) {
el.value = raw.replace(/[^A-Za-z0-9/_.\- ]/g, '');
}
}
}
function refreshParsley($form) {
try {
var p = $form.parsley();
@ -200,7 +185,6 @@
$form.off(NS);
$form.on('input' + NS, 'input:not([type=hidden]), textarea', function () {
sanitizeOnInput(this);
validateField(this);
});
$form.on('change' + NS, 'select, input:not([type=hidden]), textarea', function () {

View File

@ -1,6 +1,7 @@
/**
* Ticket forms + claim file upload: charset, email, pincode, mobile, URLs, doc names.
* Integrates with Parsley only no separate Bootstrap invalid-feedback.
* Does not strip or rewrite user input; invalid values are reported via Parsley messages only.
* Requires jQuery + Parsley. Inits run before form-validation.init binds .parsley-examples.
*
* Do not capture window.jQuery at parse time: layout/header.php loads full jQuery then jquery.slim,
@ -28,6 +29,8 @@
var MOBILE_IDS = ['emp_mobile', 'hospital_phone_no'];
var PINCODE_IDS = ['hospital_pin_code'];
var DIGITS_ONLY_IDS = ['claim_amount', 'approved_amount', 'si_amt'];
/** Same validation as claim upload URL fields — charset rules would strip : ? & from https links. */
var APPROVED_SETTLE_LETTER_URL_IDS = ['approved_letter', 'settle_letter'];
var MESSAGES = {
text: 'Only letters, numbers, spaces, and the characters / _ - . are allowed.',
@ -83,6 +86,9 @@
if (DIGITS_ONLY_IDS.indexOf(id) !== -1) {
return 'digits';
}
if (APPROVED_SETTLE_LETTER_URL_IDS.indexOf(id) !== -1) {
return 'urlfield';
}
return 'text';
}
@ -360,51 +366,12 @@
});
}
function sanitizeOnInput(el) {
var id = el.id;
if (!id || el.type === 'hidden' || isReadonly(el)) {
return;
}
var kind = getFieldKindFromElement(el);
var $el = $(el);
if (kind === 'mobile') {
var m = (el.value || '').replace(/\D/g, '').substring(0, 10);
if (el.value !== m) {
el.value = m;
}
} else if (kind === 'pincode') {
var p = (el.value || '').replace(/\D/g, '').substring(0, 6);
if (el.value !== p) {
el.value = p;
}
} else if (kind === 'digits') {
var d = (el.value || '').replace(/\D/g, '');
if (el.value !== d) {
el.value = d;
}
} else if (kind === 'email' || kind === 'personalemail' || kind === 'urlfield') {
return;
} else if (kind === 'docname') {
var dn = el.value || '';
if (!DOCNAME_ALLOWED.test(dn)) {
el.value = dn.replace(/[^a-zA-Z0-9_\- ]/g, '');
}
} else if (kind === 'text') {
var raw = el.value || '';
if (!TEXT_ALLOWED.test(raw)) {
el.value = raw.replace(/[^A-Za-z0-9/_.\- ]/g, '');
}
}
}
function onFormInput(e) {
var el = e.target;
if (!el || (el.tagName !== 'INPUT' && el.tagName !== 'TEXTAREA')) {
return;
}
sanitizeOnInput(el);
revalidateParsleyField(el);
}
function revalidateParsleyField(el) {