From 3c6cecafb5078d15318b8f944aebd39879c21b27 Mon Sep 17 00:00:00 2001 From: zeeshan Date: Mon, 6 Jul 2026 14:47:00 +0530 Subject: [PATCH] Team 3 (Phone Validation) --- ...2886-1991-4160-8224-9eb025c237fe.blade.php | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/resources/views/form/rapport-team3/1782966054-92912886-1991-4160-8224-9eb025c237fe.blade.php b/resources/views/form/rapport-team3/1782966054-92912886-1991-4160-8224-9eb025c237fe.blade.php index 233b2451..9983b95e 100644 --- a/resources/views/form/rapport-team3/1782966054-92912886-1991-4160-8224-9eb025c237fe.blade.php +++ b/resources/views/form/rapport-team3/1782966054-92912886-1991-4160-8224-9eb025c237fe.blade.php @@ -168,7 +168,7 @@ @if($question->code == 'phone_no_staff') -
+
Enter No. of Units per Respule for the Brand Order Received
@endif @@ -224,15 +224,28 @@ $(this).val($(this).val().replace(/[^a-zA-Z\s]/g, '')); }); - $('#field-phone_no_staff').on('input', function () { + /* $('#field-phone_no_staff').on('input', function () { this.value = this.value.replace(/\D/g, '').slice(0, 10); // First digit must be 6,7,8,9 if (this.value.length > 0 && !/^[6-9]/.test(this.value)) { this.value = ''; } + }); */ + + $('#field-phone_no_staff').on('input', function () { + // Allow only digits and max 10 digits + this.value = this.value.replace(/\D/g, '').slice(0, 10); + + // First digit must be 6, 7, 8, or 9 + if (this.value.length > 0 && !/^[6-9]/.test(this.value)) { + alert("Phone number must start with 6, 7, 8, or 9."); + this.value = ''; + $(this).focus(); + } }); - $('#field-budecort_respule, #field-duolin_respule, #field-levolin_respule, #field-hyperneb_respule, #field-budesal_respule').on('input', function () { + + $('#field-budecort_respule, #field-duolin_respule, #field-levolin_respule, #field-input_given_count, #field-hyperneb_respule, #field-budesal_respule').on('input', function () { this.value = this.value.replace(/[^0-9]/g, ''); }); @@ -291,6 +304,12 @@ } }); + + /* $('#field-input_name,#field-input_given_count').on('change',function(){ + $('#report-form input.dynamic-hidden').remove(); + $('#report-form').append('') + }) */ + $('#field-user_id').change(function(){ let hierarchy = $('option:selected', this).attr('hierarchy'); $('#field-hierarchy_id').val(hierarchy) @@ -316,7 +335,7 @@ $('#report-form').on('submit', function(event){ event.preventDefault(); let mobile = $('#field-phone_no_staff').val().trim(); - + $('#report-form').append('') if (!/^[6-9]\d{9}$/.test(mobile)) { Swal.fire({ icon: 'error',