Iva (Poviztra Tracker Changes)
This commit is contained in:
parent
a4b9efabf3
commit
2b7799f896
|
|
@ -262,16 +262,53 @@
|
|||
this.value = this.value.slice(0, 10);
|
||||
}
|
||||
});
|
||||
|
||||
$('#field-customer_number').on('input', function () {
|
||||
let value = $(this).val();
|
||||
|
||||
// फक्त numbers
|
||||
value = value.replace(/\D/g, '');
|
||||
|
||||
// Maximum 10 digits
|
||||
value = value.substring(0, 10);
|
||||
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
$('#field-customer_number').on('blur', function () {
|
||||
let value = $(this).val();
|
||||
|
||||
if (!/^[6-9][0-9]{9}$/.test(value)) {
|
||||
$(this).addClass('is-invalid');
|
||||
} else {
|
||||
$(this).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
let value = $('#field-customer_number').val().trim();
|
||||
|
||||
if (!/^[6-9][0-9]{9}$/.test(value)) {
|
||||
|
||||
alert('Customer No must be exactly 10 digits and start with 6, 7, 8, or 9.');
|
||||
|
||||
$('#field-customer_number')
|
||||
.val('')
|
||||
.focus();
|
||||
|
||||
return false; // Submit थांबवतो
|
||||
}
|
||||
|
||||
const formData = new FormData($('#report-form')[0]);
|
||||
// Log form data to console
|
||||
for (let [key, value] of formData.entries()) {
|
||||
console.log(key, value);
|
||||
}
|
||||
$("#pageloader").fadeIn();
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@
|
|||
});
|
||||
|
||||
|
||||
|
||||
$('#field-uid_number').attr('readonly',true);
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
|
|
|
|||
Loading…
Reference in New Issue