Enquiry Form

'; if(form != '') { form.closest('form').append(alert_box); } else { $('#form-6636893ad0a8f').append(alert_box); } } function addConditionClass(field_id, cond_class, form_fields_wrapper) { $(field_id).each(function(){ if ($(this).is(':input') || $(this).is('select')) $(this).addClass('cond_filler_'+cond_class); $(this).children().each(function(){ addConditionClass($(this), cond_class, form_fields_wrapper); }) }); return false; } function compareRule(objs, cmp_operator, cmp_value, cmp_id, $form_part_0) { var comp_res = false; var areOperandsCb = false; // Stores true if both operands are checkboxes. switch(cmp_operator) { case 'is': if (cmp_value.startsWith('Checkbox_')) { test = objs.closest('#form_part_0').find('#'+cmp_value+' :input:checked'); areOperandsCb = cmp_id.startsWith('Checkbox_') ? true : false; if (areOperandsCb && objs.length != test.length) { break; } } else { test = objs.closest('#form_part_0').find('#'+cmp_value+' :input'); } $(objs).each(function(){ if (areOperandsCb) { comp_res = false; } $cmp1 = $(this).val(); $(test).each(function(){ $cmp2 = $(this).val(); if ($cmp1 == $cmp2) { comp_res = true; if (!areOperandsCb) { return; } } }); if (areOperandsCb && false == comp_res) { return; } }); break; case 'is-not': if (cmp_value.startsWith('Checkbox_')) { test = $form_part_0.find('#'+cmp_value+' :input:checked'); areOperandsCb = cmp_id.startsWith('Checkbox_') ? true : false; if (areOperandsCb && objs.length != test.length) { return true; } } else { test = objs.closest('#form_part_0').find('#'+cmp_value+' :input'); } $.each(objs, function(obsIndex, objsElement) { comp_res = false; $cmp1 = $(objsElement).val(); $.each(test, function(testIndex, testElement) { $cmp2 = $(testElement).val(); if ($cmp1 != $cmp2) { comp_res = true; // return; } else if(areOperandsCb) { comp_res = false; return false; } }); if(areOperandsCb && true == comp_res) { return false; } }); break; case 'less-than': $(objs).each(function(){ // Return if current element is non-relevant input field inside 'Rating' field. if ('undefined' != typeof $(this).attr('id') && 'Rating_' != $(this).attr('id').match(/^Rating_/) && $(this).closest('div[id^=Rating_]').length > 0) { return; } // if cmp_value is number, convert it into number type data. if (!isNaN(cmp_value)) { cmp_value = Number(cmp_value); } if ($(this).val() < cmp_value) { comp_res = true; return; } }); break; case 'greater-than': $(objs).each(function(){ // if cmp_value is number, convert it into number type data. if (!isNaN(cmp_value)) { cmp_value = Number(cmp_value); } if ($(this).val() > cmp_value) { comp_res = true; return; } }); break; case 'starts-with': $(objs).each(function(){ if ($(this).val().indexOf(cmp_value) == 0) { comp_res = true; return; } }); break; case 'contains': $(objs).each(function(){ if ($(this).val().indexOf(cmp_value) != -1) { comp_res = true; return; } }); break; case 'ends-with': $(objs).each(function(){ indexPoint = ($(this).val().length - cmp_value.length); if (indexPoint >=0 && $(this).val().indexOf(cmp_value, indexPoint) == indexPoint) { comp_res = true; return; } }); break; default: comp_res = false; break; } return comp_res; } function applyRule(field_id) { $('.cond_filler_'+field_id).each(function(){ var this_conditions = $('#'+field_id).attr('data-cond-fields').split('|'); var this_action = $('#'+field_id).attr('data-cond-action').split(':'); var cmp_res = this_action[1] == 'all' ? true : false; for (i=0 ; i