Titans - Breathfree Camp applied Validation like at least 1 brand should be non zero value
Specific Folder FTP Upload / ftp-deploy (push) Successful in 2m3s Details

This commit is contained in:
Farhan Pathan 2026-06-18 13:21:33 +05:30
parent f7d738c639
commit 45b80c229c
1 changed files with 34 additions and 0 deletions

View File

@ -404,7 +404,41 @@
$('#report-form').on('submit', function(event){
event.preventDefault();
// At least one brand should have value > 0
let brandFields = [
'#field-glycohale_f_capsules',
'#field-glycohale_fb',
'#field-foracort_g_400_rotacaps',
'#field-glycohale_fb_inhaler',
'#field-foracort_g_inhaler',
'#field-glycohale_fb_synchrobreathe',
'#field-foracort_g_synchrobreathe',
'#field-glycohale_f_inhaler',
'#field-glycohale_f_synchrobreathe',
'#field-foracort_g_400_ciphaler',
'#field-glycohale_fb_ciphaler'
];
let hasValue = false;
brandFields.forEach(function(field) {
if ((parseInt($(field).val()) || 0) > 0) {
hasValue = true;
}
});
if (!hasValue) {
Swal.fire({
icon: 'error',
title: 'Validation Error',
text: 'From all 11 brands, at least one field should be greater than 0.'
});
return false;
}
const formData = new FormData($('#report-form')[0]);
// Log form data to console
for (let [key, value] of formData.entries()) {