Additional information
PRICE | The price of this custom-made item depends on the size, timber, finish, fittings, etc. We will be happy to quote according to your specifications. |
---|---|
LEAD TIME | As our furniture is made to order, the lead time is approximately 4 – 6 weeks. Please contact us for the current lead time. |
DELIVERY | Please contact us to confirm the delivery cost for this item. |
PARKLANE BUFFET
Send Enquiry for PARKLANE BUFFET
Thank You!
Our Parklane buffets offer beautiful and practical solutions to your serveware storage needs!
They’re handcrafted in Australia, and custom-made in any size and configuration from a wide range of select grade hardwoods.
FEATURES
- Solid timber or timber-framed glass cabinet doors
- Extending metal drawer runners
Related Products
- Select Options
PARKLANE BUFFET & HUTCH
Send Enquiry for PARKLANE BUFFET & HUTCH
<!-- var formObject = ''; jQuery(document).ready(function($){ $('.select2element').select2(); }); --> jQuery(document).ready(function($){ $(function($) { var submit_btn_text; var next_part_id; var this_part_id; // nameErrMsg - name field invalid error message. // telErrMsg - telephone field invalid error message. let nameErrMsg, telErrMsg; nameErrMsg = quoteup_cf_err_msg.name; telErrMsg = quoteup_cf_err_msg.tel_err; $(document).ready(function() { //code // Show hard form partitions var set_show = {display: 'block'}; var set_hide = {display: 'none'}; var validator = $('#form-628c8dee4a797').validate({ rules: { "submitform[custname]": { validateName: true }, // Phone fields rules // End for Phone fields rules }, ignore: ":input:hidden:not([id^=Rating_])", errorPlacement: function(error, element) { if (element.is(':checkbox') || element.is(':radio')) { error.appendTo(element.closest('div')); } else if ('undefined' != typeof element.attr('id') && 'Rating_' == element.attr('id').match(/^Rating_/)) { error.insertAfter(element.closest('div').find('div.form-group div[id^=Rating_]')); } else { // element.nextAll('div:first').before(error); element.closest('.form-group').children('div').last().before(error); } } }); jQuery.extend( jQuery.validator.messages, { email: quoteup_cf_err_msg.email, url: quoteup_cf_err_msg.url, date: quoteup_cf_err_msg.date, dateISO: quoteup_cf_err_msg.dateISO, number: quoteup_cf_err_msg.number, } ); jQuery.validator.addMethod("validateName", function (value, element) { var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); if(!validation.test(value)) { // not valid input return false; } else { // valid input return true; } }, nameErrMsg); // Validate phone number jQuery.validator.addMethod("validatePhone", function (value, element) { let iti = window.intlTelInputGlobals.getInstance(element), isValidNumber = iti.isValidNumber(), validation = new RegExp('^\\+?[0-9\\s]+$'); value = value.trim(); if (this.optional(element) || (isValidNumber && validation.test(value))) { // Valid phone number. return true; } else { // Invalid phone number. return false; } }, telErrMsg); // wdm code added commented // $("input[id^=rating_]").rules("add", { // validateRating: true // }); // jQuery.validator.addMethod("validateRating", function (value, element) { // console.log("Hello world"); // var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); // if(!validation.test(value)) { // // not valid input // return false; // } // else // { // // valid input // return true; // } // }, "Please provide rating"); // wdm code added commented var validInput = true; //$('#form_part_0').css(set_show); $('#form-628c8dee4a797 .change-part').on('click', function(e) { $('.formnotice').hide(); next_part_id = $(this).attr('data-next'); this_part_id = $(this).attr('data-parent'); id = $(this).attr('id'); prod_id = id.split('_')[1];; // Pre validate validInput = true; var $form = $(this).closest('#' + this_part_id); var $inputs = $(this).closest('#' + this_part_id).find(":input"); $inputs.each(function() { if(!validator.element(this)) { validInput = false; $(this).closest('div.form-group').removeClass('has-success').addClass('has-error'); } else { $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); if (validInput == true) { if (next_part_id != undefined) { $('#' + this_part_id).css(set_hide); $('#' + next_part_id).css(set_show); } $('#' + next_part_id + '_crumb').addClass('active'); $('#' + next_part_id + '_crumb').addClass('visited'); $('#' + this_part_id + '_crumb').removeClass('active'); $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); $('.breadcrumbs').on('click', function() { var set_show = {display: 'block'}; var set_hide = {display: 'none'}; show_part_id = $(this).parent().attr('data-part'); hide_part_id = $('.breadcrumbli.active').attr('data-part'); if ($('#' + show_part_id + '_crumb').hasClass('visited')) { $('.breadcrumbli.active').removeClass('active'); $(this).parent().addClass('active'); $('#' + hide_part_id).css(set_hide); $('#' + show_part_id).css(set_show); } else { // Show the error msgs = new Array(); msgs.push('Fill the current area to proceed'); showAlerts(msgs,'danger'); } }); /*// ajax submit var options = { url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', // variation_id:variation_id, // variation_detail:variation_detail, resetForm: false, beforeSubmit: function() { submit_btn_text = $('#submit').html(); $('#submit').html(" Please wait"); $('#submit').prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $('#submit').html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); try { response_vars = JSON.parse(response); } catch (e) { console.log(e); } if (response_vars.action == 'success' && validInput === true) { msgs.push(response_vars.message); showAlerts(msgs, 'success'); } else { msgs.push(response_vars.message == '' ? 'Form submission failed, please check the entries again' : response_vars.message); showAlerts(msgs, 'danger'); } } };*/ $('#form-628c8dee4a797').on('submit', function(e) { e.preventDefault(); $this = $('#form-628c8dee4a797').find("button[type=submit]"); var wdm_checkbox_val = 0; error_val= 0; if($this.attr('id') != 'mpeSendCustom') { id_send = $this.attr('id'); var id_array = id_send.match("btnSendCustom_(.*)"); if (jQuery("#" + id_send).closest('.row').siblings('.mpe_form_input').find("#contact-cc").is(":checked")) { wdm_checkbox_val = 'checked'; } } else { sendRequestToUpdateCart(false, false); if ( jQuery("#contact-cc").is(":checked") ) { wdm_checkbox_val = 'checked'; } } if (validInput == true && error_val == 0) { variation_id = ''; variation_detail = []; var $variation_id_obj = ''; // Select variation Id element using setting value. $variation_id_obj = jQuery(wdm_data.variation_id_selector); // If variation Id element is not found. if ($variation_id_obj.length == 0) { $variation_id_obj = $('.variation_id'); if ("undefined" != typeof id_array) { $variation_id_obj = $('#wdm-quoteup-trigger-' + id_array[1]).closest('.summary.entry-summary').find('.variation_id:first-child'); } } if ($variation_id_obj.length>0) { variation_id = $variation_id_obj.val(); $('select[name^=attribute_]').each(function(ind, obj){ name = $(this).attr('name'); name = name.substring(10); variation = name + " : " + $(this).val(); variation_detail.push(variation); }); } quantity =1; if($('input[name="quantity"]').length>0) { quantity =$('input[name="quantity"]').val(); } $form_data = new FormData(); $form_data.append('action', 'submitCustomForm'); $form_data.append('submitform[variation_id]', variation_id); $form_data.append('submitform[variation_detail]', variation_detail); $form_data.append('submitform[product_quant]', quantity); $form_data.append('submitform[cc]', wdm_checkbox_val); var checkbox_names = {}; //Loop Through all input fields $('#form-628c8dee4a797').find(':input').each(function(){ if($(this).attr('type') == 'file') { var attachedFiles = $(this).prop('files'); if(attachedFiles && attachedFiles.length > 0) { $(attachedFiles).each(function(index, value){ $file = value; $file_size = $file.size; // $form_data.append( index, $file ); $form_data.append( $file.name, $file ); }); } } else if($(this).attr('type') == 'checkbox') { //Proceed only if checkbox is checked if( !$(this).is(':checked') ){ return true; } if($(this).attr('id') == 'contact-cc') { return true; } let name = $(this).attr('name'); let current_value = $(this).val(); //Check if we have already started collecting current checkbox group if(!(name in checkbox_names)) { checkbox_names[name] = current_value; } else { checkbox_names[name] = checkbox_names[name] + "," + current_value; } } else if($(this).attr('type') == 'radio') { //Proceed only if radio is checked if( !$(this).is(':checked') ){ return true; } $form_data.append($(this).attr('name'), $(this).val()); } else if ($(this).hasClass("g-recaptcha-response")) { // If captcha version 2 and captcha field is visible. if(!$(this).closest('div.form-group').is(":hidden")) { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } } else if ($(this).hasClass('wdm-int-tel-input')) { // If phone number field. let iti = window.intlTelInputGlobals.getInstance(this), phoneNumber = iti.getNumber(), name = $(this).attr('name'); $form_data.append(name, phoneNumber); } else { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } }); //append all checkboxes in $form_data for (let name in checkbox_names) { $form_data.append(name.replace('[]', ''), checkbox_names[name]); } // $('#form-628c8dee4a797').find('select').each(function(){ // name = $(this).attr('name'); // value = $(this).val(); // $form_data.append(name, value); // }); $('#wdm-cart-count').hide(); let form_selector = '#form-628c8dee4a797'; let $cookieConField = $(form_selector + ' input#cookie-consent-cb'); if($cookieConField.length > 0 && $cookieConField.is(":checked")) { let cname = $(form_selector + ' input[name="submitform[custname]"]').val(); let cemail = $(form_selector + ' input[name="submitform[txtemail]"]').val(); fun_set_cookie(cname, cemail); } else{ fun_remove_cookie(); } if(typeof quoteup_captcha_data != 'undefined' && 'v3' == quoteup_captcha_data.captcha_version){ // captcha v3 let site_key = quoteup_captcha_data.site_key; grecaptcha.execute(site_key, {action: 'quoteup_captcha'}).then(function(token) { $form_data.append('g-recaptcha-response', token); submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); }); } else { submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); } } else { msgs = new Array(); msgs.push(err_string == '' ? quoteup_cf_err_msg.validation_err_msg : err_string); if (jQuery('.g-recaptcha').length > 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } return false; }); }); }); function submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide,set_show) { $.ajax({ type: 'POST', url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', data: $form_data, contentType: false, processData: false, dataType: 'json', // async: false, cache: false, beforeSend: function() { submit_btn_text = $this.html(); $this.html(" Please wait"); $this.prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $this.html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); $this.prop('disabled', false); if (response['action'] == 'success' && validInput === true) { msgs.push(response['message']); showAlerts(msgs, 'success'); if($('.wdm-quoteup-woo').length>0) { jQuery('.quoteup-quote-cart').slideUp(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function(){ $('.success').slideDown(); $('html, body').animate({ scrollTop: $("#success").offset().top - 700 }, 0); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 150); } else { $this.closest('.wdm-quoteup-form').hide(); $('#success_' + id_array[1]).show(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function() { id = $this.attr('id'); number = id.match("btnSendCustom_(.*)"); modal_id = "#wdm-quoteup-modal-" + number[1]; jQuery(modal_id).modal('hide'); jQuery('.wdm-quoteup-form').css('display', 'none'); jQuery('.wdm-modal-footer').css('display', 'none'); jQuery('#error').css('display', 'none'); jQuery('#nonce_error').css('display', 'none'); jQuery('#success_' + number[1]).css('display', 'none'); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 2000) } if(window.ga && ga.create) { for (i=0; i 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } } }); } function conditionalHandling() { $('.conditioned').each(function(){ var cur_field_id = $(this).attr('id'); cur_conditioned_fields = $(this).attr('data-cond-fields'); cur_cond_fields = cur_conditioned_fields.split('|'); var form_fields_wrapper = $(this).closest('#form_part_0'); for (i=0 ; i<cur_cond_fields.length ; i++) { var cond_field = cur_cond_fields[i].split(':'); let cond_field_0 = cond_field[0]; let cond_field_2 = cond_field[2].replace(/([!"#$%&'()*+,./:;[email protected][\]^`{|}~])/g, "\\$1"); if ($('#'+cond_field_0).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_0), cur_field_id, form_fields_wrapper); } if ($('#'+cond_field_2).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_2), cur_field_id, form_fields_wrapper); } } form_fields_wrapper.find('.cond_filler_'+cur_field_id).each(function(){ let curr_field_obj = $(this); applyRule(cur_field_id); // If current field is 'checkbox', 'radio' or 'select' field, then add 'change' // event on the field. if (curr_field_obj.attr('type') == 'checkbox' || curr_field_obj.attr('type') == 'radio' || curr_field_obj.is('select')) { $(this).on('change', function(){ applyRule(cur_field_id); }); } else if (curr_field_obj.attr('type') == 'text' || curr_field_obj.is(':input')) { curr_field_obj.on('keyup', function(){ applyRule(cur_field_id); }); curr_field_obj.on('focusout', function(){ applyRule(cur_field_id); }); if ('undefined' != typeof curr_field_obj.attr('id') && 'Rating_' == curr_field_obj.attr('id').match(/^Rating_/)) { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } } else { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } }); }); } $(document).ready(function($){ conditionalHandling(); }); function showAlerts(msgs, type, form) { if(form === undefined) { form = ''; } $('.formnotice').slideUp(); alert_box = '<!-- --><!-- -->'; for (i = 0; i < msgs.length; i++) { alert_box += '' + msgs[i] + ''; if(form != '') { form.closest('form').append(alert_box); } else { $('#form-628c8dee4a797').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'); } for(let objsElement of objs) { comp_res = false; $cmp1 = $(objsElement).val(); for(let testElement of test) { $cmp2 = $(testElement).val(); if ($cmp1 != $cmp2) { comp_res = true; // return; } else if(areOperandsCb) { comp_res = false; break; } } if(areOperandsCb && true == comp_res) { break; } } 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_]')) { 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 '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<this_conditions.length ; i++) { var this_condition = this_conditions[i].split(':'), $form_part_0 = null; cmp_id = this_condition[0]; cmp_objs = null; $form_part_0 = $(this).closest('#form_part_0'); if (cmp_id.indexOf('Checkbox_') == 0 || cmp_id.indexOf('Radio_') == 0) { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id).find(':checked'); } else { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id+' :input'); } cmp_operator = this_condition[1]; cmp_value = this_condition[2]; tmp_res = compareRule(cmp_objs, cmp_operator, cmp_value, cmp_id, $form_part_0); if (this_action[1] == 'all') cmp_res = cmp_res && tmp_res; else cmp_res = cmp_res || tmp_res; } if (cmp_res == true) { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide');//$('#'+field_id).addClass('hide'); } } else { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } } }); } });
'; } alert_box += 'Thank You! - Select Options
PARKLANE TV UNITS
Send Enquiry for PARKLANE TV UNITS
<!-- var formObject = ''; jQuery(document).ready(function($){ $('.select2element').select2(); }); --> jQuery(document).ready(function($){ $(function($) { var submit_btn_text; var next_part_id; var this_part_id; // nameErrMsg - name field invalid error message. // telErrMsg - telephone field invalid error message. let nameErrMsg, telErrMsg; nameErrMsg = quoteup_cf_err_msg.name; telErrMsg = quoteup_cf_err_msg.tel_err; $(document).ready(function() { //code // Show hard form partitions var set_show = {display: 'block'}; var set_hide = {display: 'none'}; var validator = $('#form-628c8dee4e697').validate({ rules: { "submitform[custname]": { validateName: true }, // Phone fields rules // End for Phone fields rules }, ignore: ":input:hidden:not([id^=Rating_])", errorPlacement: function(error, element) { if (element.is(':checkbox') || element.is(':radio')) { error.appendTo(element.closest('div')); } else if ('undefined' != typeof element.attr('id') && 'Rating_' == element.attr('id').match(/^Rating_/)) { error.insertAfter(element.closest('div').find('div.form-group div[id^=Rating_]')); } else { // element.nextAll('div:first').before(error); element.closest('.form-group').children('div').last().before(error); } } }); jQuery.extend( jQuery.validator.messages, { email: quoteup_cf_err_msg.email, url: quoteup_cf_err_msg.url, date: quoteup_cf_err_msg.date, dateISO: quoteup_cf_err_msg.dateISO, number: quoteup_cf_err_msg.number, } ); jQuery.validator.addMethod("validateName", function (value, element) { var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); if(!validation.test(value)) { // not valid input return false; } else { // valid input return true; } }, nameErrMsg); // Validate phone number jQuery.validator.addMethod("validatePhone", function (value, element) { let iti = window.intlTelInputGlobals.getInstance(element), isValidNumber = iti.isValidNumber(), validation = new RegExp('^\\+?[0-9\\s]+$'); value = value.trim(); if (this.optional(element) || (isValidNumber && validation.test(value))) { // Valid phone number. return true; } else { // Invalid phone number. return false; } }, telErrMsg); // wdm code added commented // $("input[id^=rating_]").rules("add", { // validateRating: true // }); // jQuery.validator.addMethod("validateRating", function (value, element) { // console.log("Hello world"); // var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); // if(!validation.test(value)) { // // not valid input // return false; // } // else // { // // valid input // return true; // } // }, "Please provide rating"); // wdm code added commented var validInput = true; //$('#form_part_0').css(set_show); $('#form-628c8dee4e697 .change-part').on('click', function(e) { $('.formnotice').hide(); next_part_id = $(this).attr('data-next'); this_part_id = $(this).attr('data-parent'); id = $(this).attr('id'); prod_id = id.split('_')[1];; // Pre validate validInput = true; var $form = $(this).closest('#' + this_part_id); var $inputs = $(this).closest('#' + this_part_id).find(":input"); $inputs.each(function() { if(!validator.element(this)) { validInput = false; $(this).closest('div.form-group').removeClass('has-success').addClass('has-error'); } else { $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); if (validInput == true) { if (next_part_id != undefined) { $('#' + this_part_id).css(set_hide); $('#' + next_part_id).css(set_show); } $('#' + next_part_id + '_crumb').addClass('active'); $('#' + next_part_id + '_crumb').addClass('visited'); $('#' + this_part_id + '_crumb').removeClass('active'); $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); $('.breadcrumbs').on('click', function() { var set_show = {display: 'block'}; var set_hide = {display: 'none'}; show_part_id = $(this).parent().attr('data-part'); hide_part_id = $('.breadcrumbli.active').attr('data-part'); if ($('#' + show_part_id + '_crumb').hasClass('visited')) { $('.breadcrumbli.active').removeClass('active'); $(this).parent().addClass('active'); $('#' + hide_part_id).css(set_hide); $('#' + show_part_id).css(set_show); } else { // Show the error msgs = new Array(); msgs.push('Fill the current area to proceed'); showAlerts(msgs,'danger'); } }); /*// ajax submit var options = { url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', // variation_id:variation_id, // variation_detail:variation_detail, resetForm: false, beforeSubmit: function() { submit_btn_text = $('#submit').html(); $('#submit').html(" Please wait"); $('#submit').prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $('#submit').html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); try { response_vars = JSON.parse(response); } catch (e) { console.log(e); } if (response_vars.action == 'success' && validInput === true) { msgs.push(response_vars.message); showAlerts(msgs, 'success'); } else { msgs.push(response_vars.message == '' ? 'Form submission failed, please check the entries again' : response_vars.message); showAlerts(msgs, 'danger'); } } };*/ $('#form-628c8dee4e697').on('submit', function(e) { e.preventDefault(); $this = $('#form-628c8dee4e697').find("button[type=submit]"); var wdm_checkbox_val = 0; error_val= 0; if($this.attr('id') != 'mpeSendCustom') { id_send = $this.attr('id'); var id_array = id_send.match("btnSendCustom_(.*)"); if (jQuery("#" + id_send).closest('.row').siblings('.mpe_form_input').find("#contact-cc").is(":checked")) { wdm_checkbox_val = 'checked'; } } else { sendRequestToUpdateCart(false, false); if ( jQuery("#contact-cc").is(":checked") ) { wdm_checkbox_val = 'checked'; } } if (validInput == true && error_val == 0) { variation_id = ''; variation_detail = []; var $variation_id_obj = ''; // Select variation Id element using setting value. $variation_id_obj = jQuery(wdm_data.variation_id_selector); // If variation Id element is not found. if ($variation_id_obj.length == 0) { $variation_id_obj = $('.variation_id'); if ("undefined" != typeof id_array) { $variation_id_obj = $('#wdm-quoteup-trigger-' + id_array[1]).closest('.summary.entry-summary').find('.variation_id:first-child'); } } if ($variation_id_obj.length>0) { variation_id = $variation_id_obj.val(); $('select[name^=attribute_]').each(function(ind, obj){ name = $(this).attr('name'); name = name.substring(10); variation = name + " : " + $(this).val(); variation_detail.push(variation); }); } quantity =1; if($('input[name="quantity"]').length>0) { quantity =$('input[name="quantity"]').val(); } $form_data = new FormData(); $form_data.append('action', 'submitCustomForm'); $form_data.append('submitform[variation_id]', variation_id); $form_data.append('submitform[variation_detail]', variation_detail); $form_data.append('submitform[product_quant]', quantity); $form_data.append('submitform[cc]', wdm_checkbox_val); var checkbox_names = {}; //Loop Through all input fields $('#form-628c8dee4e697').find(':input').each(function(){ if($(this).attr('type') == 'file') { var attachedFiles = $(this).prop('files'); if(attachedFiles && attachedFiles.length > 0) { $(attachedFiles).each(function(index, value){ $file = value; $file_size = $file.size; // $form_data.append( index, $file ); $form_data.append( $file.name, $file ); }); } } else if($(this).attr('type') == 'checkbox') { //Proceed only if checkbox is checked if( !$(this).is(':checked') ){ return true; } if($(this).attr('id') == 'contact-cc') { return true; } let name = $(this).attr('name'); let current_value = $(this).val(); //Check if we have already started collecting current checkbox group if(!(name in checkbox_names)) { checkbox_names[name] = current_value; } else { checkbox_names[name] = checkbox_names[name] + "," + current_value; } } else if($(this).attr('type') == 'radio') { //Proceed only if radio is checked if( !$(this).is(':checked') ){ return true; } $form_data.append($(this).attr('name'), $(this).val()); } else if ($(this).hasClass("g-recaptcha-response")) { // If captcha version 2 and captcha field is visible. if(!$(this).closest('div.form-group').is(":hidden")) { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } } else if ($(this).hasClass('wdm-int-tel-input')) { // If phone number field. let iti = window.intlTelInputGlobals.getInstance(this), phoneNumber = iti.getNumber(), name = $(this).attr('name'); $form_data.append(name, phoneNumber); } else { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } }); //append all checkboxes in $form_data for (let name in checkbox_names) { $form_data.append(name.replace('[]', ''), checkbox_names[name]); } // $('#form-628c8dee4e697').find('select').each(function(){ // name = $(this).attr('name'); // value = $(this).val(); // $form_data.append(name, value); // }); $('#wdm-cart-count').hide(); let form_selector = '#form-628c8dee4e697'; let $cookieConField = $(form_selector + ' input#cookie-consent-cb'); if($cookieConField.length > 0 && $cookieConField.is(":checked")) { let cname = $(form_selector + ' input[name="submitform[custname]"]').val(); let cemail = $(form_selector + ' input[name="submitform[txtemail]"]').val(); fun_set_cookie(cname, cemail); } else{ fun_remove_cookie(); } if(typeof quoteup_captcha_data != 'undefined' && 'v3' == quoteup_captcha_data.captcha_version){ // captcha v3 let site_key = quoteup_captcha_data.site_key; grecaptcha.execute(site_key, {action: 'quoteup_captcha'}).then(function(token) { $form_data.append('g-recaptcha-response', token); submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); }); } else { submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); } } else { msgs = new Array(); msgs.push(err_string == '' ? quoteup_cf_err_msg.validation_err_msg : err_string); if (jQuery('.g-recaptcha').length > 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } return false; }); }); }); function submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide,set_show) { $.ajax({ type: 'POST', url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', data: $form_data, contentType: false, processData: false, dataType: 'json', // async: false, cache: false, beforeSend: function() { submit_btn_text = $this.html(); $this.html(" Please wait"); $this.prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $this.html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); $this.prop('disabled', false); if (response['action'] == 'success' && validInput === true) { msgs.push(response['message']); showAlerts(msgs, 'success'); if($('.wdm-quoteup-woo').length>0) { jQuery('.quoteup-quote-cart').slideUp(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function(){ $('.success').slideDown(); $('html, body').animate({ scrollTop: $("#success").offset().top - 700 }, 0); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 150); } else { $this.closest('.wdm-quoteup-form').hide(); $('#success_' + id_array[1]).show(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function() { id = $this.attr('id'); number = id.match("btnSendCustom_(.*)"); modal_id = "#wdm-quoteup-modal-" + number[1]; jQuery(modal_id).modal('hide'); jQuery('.wdm-quoteup-form').css('display', 'none'); jQuery('.wdm-modal-footer').css('display', 'none'); jQuery('#error').css('display', 'none'); jQuery('#nonce_error').css('display', 'none'); jQuery('#success_' + number[1]).css('display', 'none'); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 2000) } if(window.ga && ga.create) { for (i=0; i 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } } }); } function conditionalHandling() { $('.conditioned').each(function(){ var cur_field_id = $(this).attr('id'); cur_conditioned_fields = $(this).attr('data-cond-fields'); cur_cond_fields = cur_conditioned_fields.split('|'); var form_fields_wrapper = $(this).closest('#form_part_0'); for (i=0 ; i<cur_cond_fields.length ; i++) { var cond_field = cur_cond_fields[i].split(':'); let cond_field_0 = cond_field[0]; let cond_field_2 = cond_field[2].replace(/([!"#$%&'()*+,./:;[email protected][\]^`{|}~])/g, "\\$1"); if ($('#'+cond_field_0).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_0), cur_field_id, form_fields_wrapper); } if ($('#'+cond_field_2).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_2), cur_field_id, form_fields_wrapper); } } form_fields_wrapper.find('.cond_filler_'+cur_field_id).each(function(){ let curr_field_obj = $(this); applyRule(cur_field_id); // If current field is 'checkbox', 'radio' or 'select' field, then add 'change' // event on the field. if (curr_field_obj.attr('type') == 'checkbox' || curr_field_obj.attr('type') == 'radio' || curr_field_obj.is('select')) { $(this).on('change', function(){ applyRule(cur_field_id); }); } else if (curr_field_obj.attr('type') == 'text' || curr_field_obj.is(':input')) { curr_field_obj.on('keyup', function(){ applyRule(cur_field_id); }); curr_field_obj.on('focusout', function(){ applyRule(cur_field_id); }); if ('undefined' != typeof curr_field_obj.attr('id') && 'Rating_' == curr_field_obj.attr('id').match(/^Rating_/)) { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } } else { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } }); }); } $(document).ready(function($){ conditionalHandling(); }); function showAlerts(msgs, type, form) { if(form === undefined) { form = ''; } $('.formnotice').slideUp(); alert_box = '<!-- --><!-- -->'; for (i = 0; i < msgs.length; i++) { alert_box += '' + msgs[i] + ''; if(form != '') { form.closest('form').append(alert_box); } else { $('#form-628c8dee4e697').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'); } for(let objsElement of objs) { comp_res = false; $cmp1 = $(objsElement).val(); for(let testElement of test) { $cmp2 = $(testElement).val(); if ($cmp1 != $cmp2) { comp_res = true; // return; } else if(areOperandsCb) { comp_res = false; break; } } if(areOperandsCb && true == comp_res) { break; } } 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_]')) { 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 '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<this_conditions.length ; i++) { var this_condition = this_conditions[i].split(':'), $form_part_0 = null; cmp_id = this_condition[0]; cmp_objs = null; $form_part_0 = $(this).closest('#form_part_0'); if (cmp_id.indexOf('Checkbox_') == 0 || cmp_id.indexOf('Radio_') == 0) { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id).find(':checked'); } else { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id+' :input'); } cmp_operator = this_condition[1]; cmp_value = this_condition[2]; tmp_res = compareRule(cmp_objs, cmp_operator, cmp_value, cmp_id, $form_part_0); if (this_action[1] == 'all') cmp_res = cmp_res && tmp_res; else cmp_res = cmp_res || tmp_res; } if (cmp_res == true) { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide');//$('#'+field_id).addClass('hide'); } } else { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } } }); } });
'; } alert_box += 'Thank You!
You may also like
- Select Options
EDO BUFFET
Send Enquiry for EDO BUFFET
<!-- var formObject = ''; jQuery(document).ready(function($){ $('.select2element').select2(); }); --> jQuery(document).ready(function($){ $(function($) { var submit_btn_text; var next_part_id; var this_part_id; // nameErrMsg - name field invalid error message. // telErrMsg - telephone field invalid error message. let nameErrMsg, telErrMsg; nameErrMsg = quoteup_cf_err_msg.name; telErrMsg = quoteup_cf_err_msg.tel_err; $(document).ready(function() { //code // Show hard form partitions var set_show = {display: 'block'}; var set_hide = {display: 'none'}; var validator = $('#form-628c8dee6aa49').validate({ rules: { "submitform[custname]": { validateName: true }, // Phone fields rules // End for Phone fields rules }, ignore: ":input:hidden:not([id^=Rating_])", errorPlacement: function(error, element) { if (element.is(':checkbox') || element.is(':radio')) { error.appendTo(element.closest('div')); } else if ('undefined' != typeof element.attr('id') && 'Rating_' == element.attr('id').match(/^Rating_/)) { error.insertAfter(element.closest('div').find('div.form-group div[id^=Rating_]')); } else { // element.nextAll('div:first').before(error); element.closest('.form-group').children('div').last().before(error); } } }); jQuery.extend( jQuery.validator.messages, { email: quoteup_cf_err_msg.email, url: quoteup_cf_err_msg.url, date: quoteup_cf_err_msg.date, dateISO: quoteup_cf_err_msg.dateISO, number: quoteup_cf_err_msg.number, } ); jQuery.validator.addMethod("validateName", function (value, element) { var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); if(!validation.test(value)) { // not valid input return false; } else { // valid input return true; } }, nameErrMsg); // Validate phone number jQuery.validator.addMethod("validatePhone", function (value, element) { let iti = window.intlTelInputGlobals.getInstance(element), isValidNumber = iti.isValidNumber(), validation = new RegExp('^\\+?[0-9\\s]+$'); value = value.trim(); if (this.optional(element) || (isValidNumber && validation.test(value))) { // Valid phone number. return true; } else { // Invalid phone number. return false; } }, telErrMsg); // wdm code added commented // $("input[id^=rating_]").rules("add", { // validateRating: true // }); // jQuery.validator.addMethod("validateRating", function (value, element) { // console.log("Hello world"); // var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); // if(!validation.test(value)) { // // not valid input // return false; // } // else // { // // valid input // return true; // } // }, "Please provide rating"); // wdm code added commented var validInput = true; //$('#form_part_0').css(set_show); $('#form-628c8dee6aa49 .change-part').on('click', function(e) { $('.formnotice').hide(); next_part_id = $(this).attr('data-next'); this_part_id = $(this).attr('data-parent'); id = $(this).attr('id'); prod_id = id.split('_')[1];; // Pre validate validInput = true; var $form = $(this).closest('#' + this_part_id); var $inputs = $(this).closest('#' + this_part_id).find(":input"); $inputs.each(function() { if(!validator.element(this)) { validInput = false; $(this).closest('div.form-group').removeClass('has-success').addClass('has-error'); } else { $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); if (validInput == true) { if (next_part_id != undefined) { $('#' + this_part_id).css(set_hide); $('#' + next_part_id).css(set_show); } $('#' + next_part_id + '_crumb').addClass('active'); $('#' + next_part_id + '_crumb').addClass('visited'); $('#' + this_part_id + '_crumb').removeClass('active'); $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); $('.breadcrumbs').on('click', function() { var set_show = {display: 'block'}; var set_hide = {display: 'none'}; show_part_id = $(this).parent().attr('data-part'); hide_part_id = $('.breadcrumbli.active').attr('data-part'); if ($('#' + show_part_id + '_crumb').hasClass('visited')) { $('.breadcrumbli.active').removeClass('active'); $(this).parent().addClass('active'); $('#' + hide_part_id).css(set_hide); $('#' + show_part_id).css(set_show); } else { // Show the error msgs = new Array(); msgs.push('Fill the current area to proceed'); showAlerts(msgs,'danger'); } }); /*// ajax submit var options = { url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', // variation_id:variation_id, // variation_detail:variation_detail, resetForm: false, beforeSubmit: function() { submit_btn_text = $('#submit').html(); $('#submit').html(" Please wait"); $('#submit').prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $('#submit').html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); try { response_vars = JSON.parse(response); } catch (e) { console.log(e); } if (response_vars.action == 'success' && validInput === true) { msgs.push(response_vars.message); showAlerts(msgs, 'success'); } else { msgs.push(response_vars.message == '' ? 'Form submission failed, please check the entries again' : response_vars.message); showAlerts(msgs, 'danger'); } } };*/ $('#form-628c8dee6aa49').on('submit', function(e) { e.preventDefault(); $this = $('#form-628c8dee6aa49').find("button[type=submit]"); var wdm_checkbox_val = 0; error_val= 0; if($this.attr('id') != 'mpeSendCustom') { id_send = $this.attr('id'); var id_array = id_send.match("btnSendCustom_(.*)"); if (jQuery("#" + id_send).closest('.row').siblings('.mpe_form_input').find("#contact-cc").is(":checked")) { wdm_checkbox_val = 'checked'; } } else { sendRequestToUpdateCart(false, false); if ( jQuery("#contact-cc").is(":checked") ) { wdm_checkbox_val = 'checked'; } } if (validInput == true && error_val == 0) { variation_id = ''; variation_detail = []; var $variation_id_obj = ''; // Select variation Id element using setting value. $variation_id_obj = jQuery(wdm_data.variation_id_selector); // If variation Id element is not found. if ($variation_id_obj.length == 0) { $variation_id_obj = $('.variation_id'); if ("undefined" != typeof id_array) { $variation_id_obj = $('#wdm-quoteup-trigger-' + id_array[1]).closest('.summary.entry-summary').find('.variation_id:first-child'); } } if ($variation_id_obj.length>0) { variation_id = $variation_id_obj.val(); $('select[name^=attribute_]').each(function(ind, obj){ name = $(this).attr('name'); name = name.substring(10); variation = name + " : " + $(this).val(); variation_detail.push(variation); }); } quantity =1; if($('input[name="quantity"]').length>0) { quantity =$('input[name="quantity"]').val(); } $form_data = new FormData(); $form_data.append('action', 'submitCustomForm'); $form_data.append('submitform[variation_id]', variation_id); $form_data.append('submitform[variation_detail]', variation_detail); $form_data.append('submitform[product_quant]', quantity); $form_data.append('submitform[cc]', wdm_checkbox_val); var checkbox_names = {}; //Loop Through all input fields $('#form-628c8dee6aa49').find(':input').each(function(){ if($(this).attr('type') == 'file') { var attachedFiles = $(this).prop('files'); if(attachedFiles && attachedFiles.length > 0) { $(attachedFiles).each(function(index, value){ $file = value; $file_size = $file.size; // $form_data.append( index, $file ); $form_data.append( $file.name, $file ); }); } } else if($(this).attr('type') == 'checkbox') { //Proceed only if checkbox is checked if( !$(this).is(':checked') ){ return true; } if($(this).attr('id') == 'contact-cc') { return true; } let name = $(this).attr('name'); let current_value = $(this).val(); //Check if we have already started collecting current checkbox group if(!(name in checkbox_names)) { checkbox_names[name] = current_value; } else { checkbox_names[name] = checkbox_names[name] + "," + current_value; } } else if($(this).attr('type') == 'radio') { //Proceed only if radio is checked if( !$(this).is(':checked') ){ return true; } $form_data.append($(this).attr('name'), $(this).val()); } else if ($(this).hasClass("g-recaptcha-response")) { // If captcha version 2 and captcha field is visible. if(!$(this).closest('div.form-group').is(":hidden")) { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } } else if ($(this).hasClass('wdm-int-tel-input')) { // If phone number field. let iti = window.intlTelInputGlobals.getInstance(this), phoneNumber = iti.getNumber(), name = $(this).attr('name'); $form_data.append(name, phoneNumber); } else { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } }); //append all checkboxes in $form_data for (let name in checkbox_names) { $form_data.append(name.replace('[]', ''), checkbox_names[name]); } // $('#form-628c8dee6aa49').find('select').each(function(){ // name = $(this).attr('name'); // value = $(this).val(); // $form_data.append(name, value); // }); $('#wdm-cart-count').hide(); let form_selector = '#form-628c8dee6aa49'; let $cookieConField = $(form_selector + ' input#cookie-consent-cb'); if($cookieConField.length > 0 && $cookieConField.is(":checked")) { let cname = $(form_selector + ' input[name="submitform[custname]"]').val(); let cemail = $(form_selector + ' input[name="submitform[txtemail]"]').val(); fun_set_cookie(cname, cemail); } else{ fun_remove_cookie(); } if(typeof quoteup_captcha_data != 'undefined' && 'v3' == quoteup_captcha_data.captcha_version){ // captcha v3 let site_key = quoteup_captcha_data.site_key; grecaptcha.execute(site_key, {action: 'quoteup_captcha'}).then(function(token) { $form_data.append('g-recaptcha-response', token); submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); }); } else { submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); } } else { msgs = new Array(); msgs.push(err_string == '' ? quoteup_cf_err_msg.validation_err_msg : err_string); if (jQuery('.g-recaptcha').length > 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } return false; }); }); }); function submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide,set_show) { $.ajax({ type: 'POST', url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', data: $form_data, contentType: false, processData: false, dataType: 'json', // async: false, cache: false, beforeSend: function() { submit_btn_text = $this.html(); $this.html(" Please wait"); $this.prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $this.html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); $this.prop('disabled', false); if (response['action'] == 'success' && validInput === true) { msgs.push(response['message']); showAlerts(msgs, 'success'); if($('.wdm-quoteup-woo').length>0) { jQuery('.quoteup-quote-cart').slideUp(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function(){ $('.success').slideDown(); $('html, body').animate({ scrollTop: $("#success").offset().top - 700 }, 0); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 150); } else { $this.closest('.wdm-quoteup-form').hide(); $('#success_' + id_array[1]).show(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function() { id = $this.attr('id'); number = id.match("btnSendCustom_(.*)"); modal_id = "#wdm-quoteup-modal-" + number[1]; jQuery(modal_id).modal('hide'); jQuery('.wdm-quoteup-form').css('display', 'none'); jQuery('.wdm-modal-footer').css('display', 'none'); jQuery('#error').css('display', 'none'); jQuery('#nonce_error').css('display', 'none'); jQuery('#success_' + number[1]).css('display', 'none'); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 2000) } if(window.ga && ga.create) { for (i=0; i 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } } }); } function conditionalHandling() { $('.conditioned').each(function(){ var cur_field_id = $(this).attr('id'); cur_conditioned_fields = $(this).attr('data-cond-fields'); cur_cond_fields = cur_conditioned_fields.split('|'); var form_fields_wrapper = $(this).closest('#form_part_0'); for (i=0 ; i<cur_cond_fields.length ; i++) { var cond_field = cur_cond_fields[i].split(':'); let cond_field_0 = cond_field[0]; let cond_field_2 = cond_field[2].replace(/([!"#$%&'()*+,./:;[email protected][\]^`{|}~])/g, "\\$1"); if ($('#'+cond_field_0).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_0), cur_field_id, form_fields_wrapper); } if ($('#'+cond_field_2).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_2), cur_field_id, form_fields_wrapper); } } form_fields_wrapper.find('.cond_filler_'+cur_field_id).each(function(){ let curr_field_obj = $(this); applyRule(cur_field_id); // If current field is 'checkbox', 'radio' or 'select' field, then add 'change' // event on the field. if (curr_field_obj.attr('type') == 'checkbox' || curr_field_obj.attr('type') == 'radio' || curr_field_obj.is('select')) { $(this).on('change', function(){ applyRule(cur_field_id); }); } else if (curr_field_obj.attr('type') == 'text' || curr_field_obj.is(':input')) { curr_field_obj.on('keyup', function(){ applyRule(cur_field_id); }); curr_field_obj.on('focusout', function(){ applyRule(cur_field_id); }); if ('undefined' != typeof curr_field_obj.attr('id') && 'Rating_' == curr_field_obj.attr('id').match(/^Rating_/)) { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } } else { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } }); }); } $(document).ready(function($){ conditionalHandling(); }); function showAlerts(msgs, type, form) { if(form === undefined) { form = ''; } $('.formnotice').slideUp(); alert_box = '<!-- --><!-- -->'; for (i = 0; i < msgs.length; i++) { alert_box += '' + msgs[i] + ''; if(form != '') { form.closest('form').append(alert_box); } else { $('#form-628c8dee6aa49').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'); } for(let objsElement of objs) { comp_res = false; $cmp1 = $(objsElement).val(); for(let testElement of test) { $cmp2 = $(testElement).val(); if ($cmp1 != $cmp2) { comp_res = true; // return; } else if(areOperandsCb) { comp_res = false; break; } } if(areOperandsCb && true == comp_res) { break; } } 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_]')) { 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 '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<this_conditions.length ; i++) { var this_condition = this_conditions[i].split(':'), $form_part_0 = null; cmp_id = this_condition[0]; cmp_objs = null; $form_part_0 = $(this).closest('#form_part_0'); if (cmp_id.indexOf('Checkbox_') == 0 || cmp_id.indexOf('Radio_') == 0) { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id).find(':checked'); } else { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id+' :input'); } cmp_operator = this_condition[1]; cmp_value = this_condition[2]; tmp_res = compareRule(cmp_objs, cmp_operator, cmp_value, cmp_id, $form_part_0); if (this_action[1] == 'all') cmp_res = cmp_res && tmp_res; else cmp_res = cmp_res || tmp_res; } if (cmp_res == true) { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide');//$('#'+field_id).addClass('hide'); } } else { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } } }); } });
'; } alert_box += 'Thank You! - Select Options
KOBE BUFFET
Send Enquiry for KOBE BUFFET
<!-- var formObject = ''; jQuery(document).ready(function($){ $('.select2element').select2(); }); --> jQuery(document).ready(function($){ $(function($) { var submit_btn_text; var next_part_id; var this_part_id; // nameErrMsg - name field invalid error message. // telErrMsg - telephone field invalid error message. let nameErrMsg, telErrMsg; nameErrMsg = quoteup_cf_err_msg.name; telErrMsg = quoteup_cf_err_msg.tel_err; $(document).ready(function() { //code // Show hard form partitions var set_show = {display: 'block'}; var set_hide = {display: 'none'}; var validator = $('#form-628c8dee6f0c6').validate({ rules: { "submitform[custname]": { validateName: true }, // Phone fields rules // End for Phone fields rules }, ignore: ":input:hidden:not([id^=Rating_])", errorPlacement: function(error, element) { if (element.is(':checkbox') || element.is(':radio')) { error.appendTo(element.closest('div')); } else if ('undefined' != typeof element.attr('id') && 'Rating_' == element.attr('id').match(/^Rating_/)) { error.insertAfter(element.closest('div').find('div.form-group div[id^=Rating_]')); } else { // element.nextAll('div:first').before(error); element.closest('.form-group').children('div').last().before(error); } } }); jQuery.extend( jQuery.validator.messages, { email: quoteup_cf_err_msg.email, url: quoteup_cf_err_msg.url, date: quoteup_cf_err_msg.date, dateISO: quoteup_cf_err_msg.dateISO, number: quoteup_cf_err_msg.number, } ); jQuery.validator.addMethod("validateName", function (value, element) { var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); if(!validation.test(value)) { // not valid input return false; } else { // valid input return true; } }, nameErrMsg); // Validate phone number jQuery.validator.addMethod("validatePhone", function (value, element) { let iti = window.intlTelInputGlobals.getInstance(element), isValidNumber = iti.isValidNumber(), validation = new RegExp('^\\+?[0-9\\s]+$'); value = value.trim(); if (this.optional(element) || (isValidNumber && validation.test(value))) { // Valid phone number. return true; } else { // Invalid phone number. return false; } }, telErrMsg); // wdm code added commented // $("input[id^=rating_]").rules("add", { // validateRating: true // }); // jQuery.validator.addMethod("validateRating", function (value, element) { // console.log("Hello world"); // var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); // if(!validation.test(value)) { // // not valid input // return false; // } // else // { // // valid input // return true; // } // }, "Please provide rating"); // wdm code added commented var validInput = true; //$('#form_part_0').css(set_show); $('#form-628c8dee6f0c6 .change-part').on('click', function(e) { $('.formnotice').hide(); next_part_id = $(this).attr('data-next'); this_part_id = $(this).attr('data-parent'); id = $(this).attr('id'); prod_id = id.split('_')[1];; // Pre validate validInput = true; var $form = $(this).closest('#' + this_part_id); var $inputs = $(this).closest('#' + this_part_id).find(":input"); $inputs.each(function() { if(!validator.element(this)) { validInput = false; $(this).closest('div.form-group').removeClass('has-success').addClass('has-error'); } else { $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); if (validInput == true) { if (next_part_id != undefined) { $('#' + this_part_id).css(set_hide); $('#' + next_part_id).css(set_show); } $('#' + next_part_id + '_crumb').addClass('active'); $('#' + next_part_id + '_crumb').addClass('visited'); $('#' + this_part_id + '_crumb').removeClass('active'); $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); $('.breadcrumbs').on('click', function() { var set_show = {display: 'block'}; var set_hide = {display: 'none'}; show_part_id = $(this).parent().attr('data-part'); hide_part_id = $('.breadcrumbli.active').attr('data-part'); if ($('#' + show_part_id + '_crumb').hasClass('visited')) { $('.breadcrumbli.active').removeClass('active'); $(this).parent().addClass('active'); $('#' + hide_part_id).css(set_hide); $('#' + show_part_id).css(set_show); } else { // Show the error msgs = new Array(); msgs.push('Fill the current area to proceed'); showAlerts(msgs,'danger'); } }); /*// ajax submit var options = { url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', // variation_id:variation_id, // variation_detail:variation_detail, resetForm: false, beforeSubmit: function() { submit_btn_text = $('#submit').html(); $('#submit').html(" Please wait"); $('#submit').prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $('#submit').html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); try { response_vars = JSON.parse(response); } catch (e) { console.log(e); } if (response_vars.action == 'success' && validInput === true) { msgs.push(response_vars.message); showAlerts(msgs, 'success'); } else { msgs.push(response_vars.message == '' ? 'Form submission failed, please check the entries again' : response_vars.message); showAlerts(msgs, 'danger'); } } };*/ $('#form-628c8dee6f0c6').on('submit', function(e) { e.preventDefault(); $this = $('#form-628c8dee6f0c6').find("button[type=submit]"); var wdm_checkbox_val = 0; error_val= 0; if($this.attr('id') != 'mpeSendCustom') { id_send = $this.attr('id'); var id_array = id_send.match("btnSendCustom_(.*)"); if (jQuery("#" + id_send).closest('.row').siblings('.mpe_form_input').find("#contact-cc").is(":checked")) { wdm_checkbox_val = 'checked'; } } else { sendRequestToUpdateCart(false, false); if ( jQuery("#contact-cc").is(":checked") ) { wdm_checkbox_val = 'checked'; } } if (validInput == true && error_val == 0) { variation_id = ''; variation_detail = []; var $variation_id_obj = ''; // Select variation Id element using setting value. $variation_id_obj = jQuery(wdm_data.variation_id_selector); // If variation Id element is not found. if ($variation_id_obj.length == 0) { $variation_id_obj = $('.variation_id'); if ("undefined" != typeof id_array) { $variation_id_obj = $('#wdm-quoteup-trigger-' + id_array[1]).closest('.summary.entry-summary').find('.variation_id:first-child'); } } if ($variation_id_obj.length>0) { variation_id = $variation_id_obj.val(); $('select[name^=attribute_]').each(function(ind, obj){ name = $(this).attr('name'); name = name.substring(10); variation = name + " : " + $(this).val(); variation_detail.push(variation); }); } quantity =1; if($('input[name="quantity"]').length>0) { quantity =$('input[name="quantity"]').val(); } $form_data = new FormData(); $form_data.append('action', 'submitCustomForm'); $form_data.append('submitform[variation_id]', variation_id); $form_data.append('submitform[variation_detail]', variation_detail); $form_data.append('submitform[product_quant]', quantity); $form_data.append('submitform[cc]', wdm_checkbox_val); var checkbox_names = {}; //Loop Through all input fields $('#form-628c8dee6f0c6').find(':input').each(function(){ if($(this).attr('type') == 'file') { var attachedFiles = $(this).prop('files'); if(attachedFiles && attachedFiles.length > 0) { $(attachedFiles).each(function(index, value){ $file = value; $file_size = $file.size; // $form_data.append( index, $file ); $form_data.append( $file.name, $file ); }); } } else if($(this).attr('type') == 'checkbox') { //Proceed only if checkbox is checked if( !$(this).is(':checked') ){ return true; } if($(this).attr('id') == 'contact-cc') { return true; } let name = $(this).attr('name'); let current_value = $(this).val(); //Check if we have already started collecting current checkbox group if(!(name in checkbox_names)) { checkbox_names[name] = current_value; } else { checkbox_names[name] = checkbox_names[name] + "," + current_value; } } else if($(this).attr('type') == 'radio') { //Proceed only if radio is checked if( !$(this).is(':checked') ){ return true; } $form_data.append($(this).attr('name'), $(this).val()); } else if ($(this).hasClass("g-recaptcha-response")) { // If captcha version 2 and captcha field is visible. if(!$(this).closest('div.form-group').is(":hidden")) { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } } else if ($(this).hasClass('wdm-int-tel-input')) { // If phone number field. let iti = window.intlTelInputGlobals.getInstance(this), phoneNumber = iti.getNumber(), name = $(this).attr('name'); $form_data.append(name, phoneNumber); } else { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } }); //append all checkboxes in $form_data for (let name in checkbox_names) { $form_data.append(name.replace('[]', ''), checkbox_names[name]); } // $('#form-628c8dee6f0c6').find('select').each(function(){ // name = $(this).attr('name'); // value = $(this).val(); // $form_data.append(name, value); // }); $('#wdm-cart-count').hide(); let form_selector = '#form-628c8dee6f0c6'; let $cookieConField = $(form_selector + ' input#cookie-consent-cb'); if($cookieConField.length > 0 && $cookieConField.is(":checked")) { let cname = $(form_selector + ' input[name="submitform[custname]"]').val(); let cemail = $(form_selector + ' input[name="submitform[txtemail]"]').val(); fun_set_cookie(cname, cemail); } else{ fun_remove_cookie(); } if(typeof quoteup_captcha_data != 'undefined' && 'v3' == quoteup_captcha_data.captcha_version){ // captcha v3 let site_key = quoteup_captcha_data.site_key; grecaptcha.execute(site_key, {action: 'quoteup_captcha'}).then(function(token) { $form_data.append('g-recaptcha-response', token); submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); }); } else { submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); } } else { msgs = new Array(); msgs.push(err_string == '' ? quoteup_cf_err_msg.validation_err_msg : err_string); if (jQuery('.g-recaptcha').length > 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } return false; }); }); }); function submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide,set_show) { $.ajax({ type: 'POST', url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', data: $form_data, contentType: false, processData: false, dataType: 'json', // async: false, cache: false, beforeSend: function() { submit_btn_text = $this.html(); $this.html(" Please wait"); $this.prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $this.html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); $this.prop('disabled', false); if (response['action'] == 'success' && validInput === true) { msgs.push(response['message']); showAlerts(msgs, 'success'); if($('.wdm-quoteup-woo').length>0) { jQuery('.quoteup-quote-cart').slideUp(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function(){ $('.success').slideDown(); $('html, body').animate({ scrollTop: $("#success").offset().top - 700 }, 0); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 150); } else { $this.closest('.wdm-quoteup-form').hide(); $('#success_' + id_array[1]).show(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function() { id = $this.attr('id'); number = id.match("btnSendCustom_(.*)"); modal_id = "#wdm-quoteup-modal-" + number[1]; jQuery(modal_id).modal('hide'); jQuery('.wdm-quoteup-form').css('display', 'none'); jQuery('.wdm-modal-footer').css('display', 'none'); jQuery('#error').css('display', 'none'); jQuery('#nonce_error').css('display', 'none'); jQuery('#success_' + number[1]).css('display', 'none'); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 2000) } if(window.ga && ga.create) { for (i=0; i 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } } }); } function conditionalHandling() { $('.conditioned').each(function(){ var cur_field_id = $(this).attr('id'); cur_conditioned_fields = $(this).attr('data-cond-fields'); cur_cond_fields = cur_conditioned_fields.split('|'); var form_fields_wrapper = $(this).closest('#form_part_0'); for (i=0 ; i<cur_cond_fields.length ; i++) { var cond_field = cur_cond_fields[i].split(':'); let cond_field_0 = cond_field[0]; let cond_field_2 = cond_field[2].replace(/([!"#$%&'()*+,./:;[email protected][\]^`{|}~])/g, "\\$1"); if ($('#'+cond_field_0).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_0), cur_field_id, form_fields_wrapper); } if ($('#'+cond_field_2).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_2), cur_field_id, form_fields_wrapper); } } form_fields_wrapper.find('.cond_filler_'+cur_field_id).each(function(){ let curr_field_obj = $(this); applyRule(cur_field_id); // If current field is 'checkbox', 'radio' or 'select' field, then add 'change' // event on the field. if (curr_field_obj.attr('type') == 'checkbox' || curr_field_obj.attr('type') == 'radio' || curr_field_obj.is('select')) { $(this).on('change', function(){ applyRule(cur_field_id); }); } else if (curr_field_obj.attr('type') == 'text' || curr_field_obj.is(':input')) { curr_field_obj.on('keyup', function(){ applyRule(cur_field_id); }); curr_field_obj.on('focusout', function(){ applyRule(cur_field_id); }); if ('undefined' != typeof curr_field_obj.attr('id') && 'Rating_' == curr_field_obj.attr('id').match(/^Rating_/)) { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } } else { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } }); }); } $(document).ready(function($){ conditionalHandling(); }); function showAlerts(msgs, type, form) { if(form === undefined) { form = ''; } $('.formnotice').slideUp(); alert_box = '<!-- --><!-- -->'; for (i = 0; i < msgs.length; i++) { alert_box += '' + msgs[i] + ''; if(form != '') { form.closest('form').append(alert_box); } else { $('#form-628c8dee6f0c6').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'); } for(let objsElement of objs) { comp_res = false; $cmp1 = $(objsElement).val(); for(let testElement of test) { $cmp2 = $(testElement).val(); if ($cmp1 != $cmp2) { comp_res = true; // return; } else if(areOperandsCb) { comp_res = false; break; } } if(areOperandsCb && true == comp_res) { break; } } 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_]')) { 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 '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<this_conditions.length ; i++) { var this_condition = this_conditions[i].split(':'), $form_part_0 = null; cmp_id = this_condition[0]; cmp_objs = null; $form_part_0 = $(this).closest('#form_part_0'); if (cmp_id.indexOf('Checkbox_') == 0 || cmp_id.indexOf('Radio_') == 0) { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id).find(':checked'); } else { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id+' :input'); } cmp_operator = this_condition[1]; cmp_value = this_condition[2]; tmp_res = compareRule(cmp_objs, cmp_operator, cmp_value, cmp_id, $form_part_0); if (this_action[1] == 'all') cmp_res = cmp_res && tmp_res; else cmp_res = cmp_res || tmp_res; } if (cmp_res == true) { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide');//$('#'+field_id).addClass('hide'); } } else { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } } }); } });
'; } alert_box += 'Thank You! - Select Options
TORINO BUFFET
Send Enquiry for TORINO BUFFET
<!-- var formObject = ''; jQuery(document).ready(function($){ $('.select2element').select2(); }); --> jQuery(document).ready(function($){ $(function($) { var submit_btn_text; var next_part_id; var this_part_id; // nameErrMsg - name field invalid error message. // telErrMsg - telephone field invalid error message. let nameErrMsg, telErrMsg; nameErrMsg = quoteup_cf_err_msg.name; telErrMsg = quoteup_cf_err_msg.tel_err; $(document).ready(function() { //code // Show hard form partitions var set_show = {display: 'block'}; var set_hide = {display: 'none'}; var validator = $('#form-628c8dee73a65').validate({ rules: { "submitform[custname]": { validateName: true }, // Phone fields rules // End for Phone fields rules }, ignore: ":input:hidden:not([id^=Rating_])", errorPlacement: function(error, element) { if (element.is(':checkbox') || element.is(':radio')) { error.appendTo(element.closest('div')); } else if ('undefined' != typeof element.attr('id') && 'Rating_' == element.attr('id').match(/^Rating_/)) { error.insertAfter(element.closest('div').find('div.form-group div[id^=Rating_]')); } else { // element.nextAll('div:first').before(error); element.closest('.form-group').children('div').last().before(error); } } }); jQuery.extend( jQuery.validator.messages, { email: quoteup_cf_err_msg.email, url: quoteup_cf_err_msg.url, date: quoteup_cf_err_msg.date, dateISO: quoteup_cf_err_msg.dateISO, number: quoteup_cf_err_msg.number, } ); jQuery.validator.addMethod("validateName", function (value, element) { var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); if(!validation.test(value)) { // not valid input return false; } else { // valid input return true; } }, nameErrMsg); // Validate phone number jQuery.validator.addMethod("validatePhone", function (value, element) { let iti = window.intlTelInputGlobals.getInstance(element), isValidNumber = iti.isValidNumber(), validation = new RegExp('^\\+?[0-9\\s]+$'); value = value.trim(); if (this.optional(element) || (isValidNumber && validation.test(value))) { // Valid phone number. return true; } else { // Invalid phone number. return false; } }, telErrMsg); // wdm code added commented // $("input[id^=rating_]").rules("add", { // validateRating: true // }); // jQuery.validator.addMethod("validateRating", function (value, element) { // console.log("Hello world"); // var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); // if(!validation.test(value)) { // // not valid input // return false; // } // else // { // // valid input // return true; // } // }, "Please provide rating"); // wdm code added commented var validInput = true; //$('#form_part_0').css(set_show); $('#form-628c8dee73a65 .change-part').on('click', function(e) { $('.formnotice').hide(); next_part_id = $(this).attr('data-next'); this_part_id = $(this).attr('data-parent'); id = $(this).attr('id'); prod_id = id.split('_')[1];; // Pre validate validInput = true; var $form = $(this).closest('#' + this_part_id); var $inputs = $(this).closest('#' + this_part_id).find(":input"); $inputs.each(function() { if(!validator.element(this)) { validInput = false; $(this).closest('div.form-group').removeClass('has-success').addClass('has-error'); } else { $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); if (validInput == true) { if (next_part_id != undefined) { $('#' + this_part_id).css(set_hide); $('#' + next_part_id).css(set_show); } $('#' + next_part_id + '_crumb').addClass('active'); $('#' + next_part_id + '_crumb').addClass('visited'); $('#' + this_part_id + '_crumb').removeClass('active'); $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); $('.breadcrumbs').on('click', function() { var set_show = {display: 'block'}; var set_hide = {display: 'none'}; show_part_id = $(this).parent().attr('data-part'); hide_part_id = $('.breadcrumbli.active').attr('data-part'); if ($('#' + show_part_id + '_crumb').hasClass('visited')) { $('.breadcrumbli.active').removeClass('active'); $(this).parent().addClass('active'); $('#' + hide_part_id).css(set_hide); $('#' + show_part_id).css(set_show); } else { // Show the error msgs = new Array(); msgs.push('Fill the current area to proceed'); showAlerts(msgs,'danger'); } }); /*// ajax submit var options = { url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', // variation_id:variation_id, // variation_detail:variation_detail, resetForm: false, beforeSubmit: function() { submit_btn_text = $('#submit').html(); $('#submit').html(" Please wait"); $('#submit').prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $('#submit').html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); try { response_vars = JSON.parse(response); } catch (e) { console.log(e); } if (response_vars.action == 'success' && validInput === true) { msgs.push(response_vars.message); showAlerts(msgs, 'success'); } else { msgs.push(response_vars.message == '' ? 'Form submission failed, please check the entries again' : response_vars.message); showAlerts(msgs, 'danger'); } } };*/ $('#form-628c8dee73a65').on('submit', function(e) { e.preventDefault(); $this = $('#form-628c8dee73a65').find("button[type=submit]"); var wdm_checkbox_val = 0; error_val= 0; if($this.attr('id') != 'mpeSendCustom') { id_send = $this.attr('id'); var id_array = id_send.match("btnSendCustom_(.*)"); if (jQuery("#" + id_send).closest('.row').siblings('.mpe_form_input').find("#contact-cc").is(":checked")) { wdm_checkbox_val = 'checked'; } } else { sendRequestToUpdateCart(false, false); if ( jQuery("#contact-cc").is(":checked") ) { wdm_checkbox_val = 'checked'; } } if (validInput == true && error_val == 0) { variation_id = ''; variation_detail = []; var $variation_id_obj = ''; // Select variation Id element using setting value. $variation_id_obj = jQuery(wdm_data.variation_id_selector); // If variation Id element is not found. if ($variation_id_obj.length == 0) { $variation_id_obj = $('.variation_id'); if ("undefined" != typeof id_array) { $variation_id_obj = $('#wdm-quoteup-trigger-' + id_array[1]).closest('.summary.entry-summary').find('.variation_id:first-child'); } } if ($variation_id_obj.length>0) { variation_id = $variation_id_obj.val(); $('select[name^=attribute_]').each(function(ind, obj){ name = $(this).attr('name'); name = name.substring(10); variation = name + " : " + $(this).val(); variation_detail.push(variation); }); } quantity =1; if($('input[name="quantity"]').length>0) { quantity =$('input[name="quantity"]').val(); } $form_data = new FormData(); $form_data.append('action', 'submitCustomForm'); $form_data.append('submitform[variation_id]', variation_id); $form_data.append('submitform[variation_detail]', variation_detail); $form_data.append('submitform[product_quant]', quantity); $form_data.append('submitform[cc]', wdm_checkbox_val); var checkbox_names = {}; //Loop Through all input fields $('#form-628c8dee73a65').find(':input').each(function(){ if($(this).attr('type') == 'file') { var attachedFiles = $(this).prop('files'); if(attachedFiles && attachedFiles.length > 0) { $(attachedFiles).each(function(index, value){ $file = value; $file_size = $file.size; // $form_data.append( index, $file ); $form_data.append( $file.name, $file ); }); } } else if($(this).attr('type') == 'checkbox') { //Proceed only if checkbox is checked if( !$(this).is(':checked') ){ return true; } if($(this).attr('id') == 'contact-cc') { return true; } let name = $(this).attr('name'); let current_value = $(this).val(); //Check if we have already started collecting current checkbox group if(!(name in checkbox_names)) { checkbox_names[name] = current_value; } else { checkbox_names[name] = checkbox_names[name] + "," + current_value; } } else if($(this).attr('type') == 'radio') { //Proceed only if radio is checked if( !$(this).is(':checked') ){ return true; } $form_data.append($(this).attr('name'), $(this).val()); } else if ($(this).hasClass("g-recaptcha-response")) { // If captcha version 2 and captcha field is visible. if(!$(this).closest('div.form-group').is(":hidden")) { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } } else if ($(this).hasClass('wdm-int-tel-input')) { // If phone number field. let iti = window.intlTelInputGlobals.getInstance(this), phoneNumber = iti.getNumber(), name = $(this).attr('name'); $form_data.append(name, phoneNumber); } else { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } }); //append all checkboxes in $form_data for (let name in checkbox_names) { $form_data.append(name.replace('[]', ''), checkbox_names[name]); } // $('#form-628c8dee73a65').find('select').each(function(){ // name = $(this).attr('name'); // value = $(this).val(); // $form_data.append(name, value); // }); $('#wdm-cart-count').hide(); let form_selector = '#form-628c8dee73a65'; let $cookieConField = $(form_selector + ' input#cookie-consent-cb'); if($cookieConField.length > 0 && $cookieConField.is(":checked")) { let cname = $(form_selector + ' input[name="submitform[custname]"]').val(); let cemail = $(form_selector + ' input[name="submitform[txtemail]"]').val(); fun_set_cookie(cname, cemail); } else{ fun_remove_cookie(); } if(typeof quoteup_captcha_data != 'undefined' && 'v3' == quoteup_captcha_data.captcha_version){ // captcha v3 let site_key = quoteup_captcha_data.site_key; grecaptcha.execute(site_key, {action: 'quoteup_captcha'}).then(function(token) { $form_data.append('g-recaptcha-response', token); submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); }); } else { submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); } } else { msgs = new Array(); msgs.push(err_string == '' ? quoteup_cf_err_msg.validation_err_msg : err_string); if (jQuery('.g-recaptcha').length > 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } return false; }); }); }); function submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide,set_show) { $.ajax({ type: 'POST', url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', data: $form_data, contentType: false, processData: false, dataType: 'json', // async: false, cache: false, beforeSend: function() { submit_btn_text = $this.html(); $this.html(" Please wait"); $this.prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $this.html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); $this.prop('disabled', false); if (response['action'] == 'success' && validInput === true) { msgs.push(response['message']); showAlerts(msgs, 'success'); if($('.wdm-quoteup-woo').length>0) { jQuery('.quoteup-quote-cart').slideUp(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function(){ $('.success').slideDown(); $('html, body').animate({ scrollTop: $("#success").offset().top - 700 }, 0); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 150); } else { $this.closest('.wdm-quoteup-form').hide(); $('#success_' + id_array[1]).show(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function() { id = $this.attr('id'); number = id.match("btnSendCustom_(.*)"); modal_id = "#wdm-quoteup-modal-" + number[1]; jQuery(modal_id).modal('hide'); jQuery('.wdm-quoteup-form').css('display', 'none'); jQuery('.wdm-modal-footer').css('display', 'none'); jQuery('#error').css('display', 'none'); jQuery('#nonce_error').css('display', 'none'); jQuery('#success_' + number[1]).css('display', 'none'); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 2000) } if(window.ga && ga.create) { for (i=0; i 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } } }); } function conditionalHandling() { $('.conditioned').each(function(){ var cur_field_id = $(this).attr('id'); cur_conditioned_fields = $(this).attr('data-cond-fields'); cur_cond_fields = cur_conditioned_fields.split('|'); var form_fields_wrapper = $(this).closest('#form_part_0'); for (i=0 ; i<cur_cond_fields.length ; i++) { var cond_field = cur_cond_fields[i].split(':'); let cond_field_0 = cond_field[0]; let cond_field_2 = cond_field[2].replace(/([!"#$%&'()*+,./:;[email protected][\]^`{|}~])/g, "\\$1"); if ($('#'+cond_field_0).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_0), cur_field_id, form_fields_wrapper); } if ($('#'+cond_field_2).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_2), cur_field_id, form_fields_wrapper); } } form_fields_wrapper.find('.cond_filler_'+cur_field_id).each(function(){ let curr_field_obj = $(this); applyRule(cur_field_id); // If current field is 'checkbox', 'radio' or 'select' field, then add 'change' // event on the field. if (curr_field_obj.attr('type') == 'checkbox' || curr_field_obj.attr('type') == 'radio' || curr_field_obj.is('select')) { $(this).on('change', function(){ applyRule(cur_field_id); }); } else if (curr_field_obj.attr('type') == 'text' || curr_field_obj.is(':input')) { curr_field_obj.on('keyup', function(){ applyRule(cur_field_id); }); curr_field_obj.on('focusout', function(){ applyRule(cur_field_id); }); if ('undefined' != typeof curr_field_obj.attr('id') && 'Rating_' == curr_field_obj.attr('id').match(/^Rating_/)) { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } } else { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } }); }); } $(document).ready(function($){ conditionalHandling(); }); function showAlerts(msgs, type, form) { if(form === undefined) { form = ''; } $('.formnotice').slideUp(); alert_box = '<!-- --><!-- -->'; for (i = 0; i < msgs.length; i++) { alert_box += '' + msgs[i] + ''; if(form != '') { form.closest('form').append(alert_box); } else { $('#form-628c8dee73a65').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'); } for(let objsElement of objs) { comp_res = false; $cmp1 = $(objsElement).val(); for(let testElement of test) { $cmp2 = $(testElement).val(); if ($cmp1 != $cmp2) { comp_res = true; // return; } else if(areOperandsCb) { comp_res = false; break; } } if(areOperandsCb && true == comp_res) { break; } } 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_]')) { 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 '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<this_conditions.length ; i++) { var this_condition = this_conditions[i].split(':'), $form_part_0 = null; cmp_id = this_condition[0]; cmp_objs = null; $form_part_0 = $(this).closest('#form_part_0'); if (cmp_id.indexOf('Checkbox_') == 0 || cmp_id.indexOf('Radio_') == 0) { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id).find(':checked'); } else { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id+' :input'); } cmp_operator = this_condition[1]; cmp_value = this_condition[2]; tmp_res = compareRule(cmp_objs, cmp_operator, cmp_value, cmp_id, $form_part_0); if (this_action[1] == 'all') cmp_res = cmp_res && tmp_res; else cmp_res = cmp_res || tmp_res; } if (cmp_res == true) { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide');//$('#'+field_id).addClass('hide'); } } else { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } } }); } });
'; } alert_box += 'Thank You! - Select Options
RAVENNA BUFFET
Send Enquiry for RAVENNA BUFFET
<!-- var formObject = ''; jQuery(document).ready(function($){ $('.select2element').select2(); }); --> jQuery(document).ready(function($){ $(function($) { var submit_btn_text; var next_part_id; var this_part_id; // nameErrMsg - name field invalid error message. // telErrMsg - telephone field invalid error message. let nameErrMsg, telErrMsg; nameErrMsg = quoteup_cf_err_msg.name; telErrMsg = quoteup_cf_err_msg.tel_err; $(document).ready(function() { //code // Show hard form partitions var set_show = {display: 'block'}; var set_hide = {display: 'none'}; var validator = $('#form-628c8dee7919d').validate({ rules: { "submitform[custname]": { validateName: true }, // Phone fields rules // End for Phone fields rules }, ignore: ":input:hidden:not([id^=Rating_])", errorPlacement: function(error, element) { if (element.is(':checkbox') || element.is(':radio')) { error.appendTo(element.closest('div')); } else if ('undefined' != typeof element.attr('id') && 'Rating_' == element.attr('id').match(/^Rating_/)) { error.insertAfter(element.closest('div').find('div.form-group div[id^=Rating_]')); } else { // element.nextAll('div:first').before(error); element.closest('.form-group').children('div').last().before(error); } } }); jQuery.extend( jQuery.validator.messages, { email: quoteup_cf_err_msg.email, url: quoteup_cf_err_msg.url, date: quoteup_cf_err_msg.date, dateISO: quoteup_cf_err_msg.dateISO, number: quoteup_cf_err_msg.number, } ); jQuery.validator.addMethod("validateName", function (value, element) { var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); if(!validation.test(value)) { // not valid input return false; } else { // valid input return true; } }, nameErrMsg); // Validate phone number jQuery.validator.addMethod("validatePhone", function (value, element) { let iti = window.intlTelInputGlobals.getInstance(element), isValidNumber = iti.isValidNumber(), validation = new RegExp('^\\+?[0-9\\s]+$'); value = value.trim(); if (this.optional(element) || (isValidNumber && validation.test(value))) { // Valid phone number. return true; } else { // Invalid phone number. return false; } }, telErrMsg); // wdm code added commented // $("input[id^=rating_]").rules("add", { // validateRating: true // }); // jQuery.validator.addMethod("validateRating", function (value, element) { // console.log("Hello world"); // var validation = new RegExp('^([^[email protected]#$%^&*()+{}:;\//",.?*~`]*)$'); // if(!validation.test(value)) { // // not valid input // return false; // } // else // { // // valid input // return true; // } // }, "Please provide rating"); // wdm code added commented var validInput = true; //$('#form_part_0').css(set_show); $('#form-628c8dee7919d .change-part').on('click', function(e) { $('.formnotice').hide(); next_part_id = $(this).attr('data-next'); this_part_id = $(this).attr('data-parent'); id = $(this).attr('id'); prod_id = id.split('_')[1];; // Pre validate validInput = true; var $form = $(this).closest('#' + this_part_id); var $inputs = $(this).closest('#' + this_part_id).find(":input"); $inputs.each(function() { if(!validator.element(this)) { validInput = false; $(this).closest('div.form-group').removeClass('has-success').addClass('has-error'); } else { $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); if (validInput == true) { if (next_part_id != undefined) { $('#' + this_part_id).css(set_hide); $('#' + next_part_id).css(set_show); } $('#' + next_part_id + '_crumb').addClass('active'); $('#' + next_part_id + '_crumb').addClass('visited'); $('#' + this_part_id + '_crumb').removeClass('active'); $(this).closest('div.form-group').removeClass('has-error').addClass('has-success'); } }); $('.breadcrumbs').on('click', function() { var set_show = {display: 'block'}; var set_hide = {display: 'none'}; show_part_id = $(this).parent().attr('data-part'); hide_part_id = $('.breadcrumbli.active').attr('data-part'); if ($('#' + show_part_id + '_crumb').hasClass('visited')) { $('.breadcrumbli.active').removeClass('active'); $(this).parent().addClass('active'); $('#' + hide_part_id).css(set_hide); $('#' + show_part_id).css(set_show); } else { // Show the error msgs = new Array(); msgs.push('Fill the current area to proceed'); showAlerts(msgs,'danger'); } }); /*// ajax submit var options = { url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', // variation_id:variation_id, // variation_detail:variation_detail, resetForm: false, beforeSubmit: function() { submit_btn_text = $('#submit').html(); $('#submit').html(" Please wait"); $('#submit').prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $('#submit').html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); try { response_vars = JSON.parse(response); } catch (e) { console.log(e); } if (response_vars.action == 'success' && validInput === true) { msgs.push(response_vars.message); showAlerts(msgs, 'success'); } else { msgs.push(response_vars.message == '' ? 'Form submission failed, please check the entries again' : response_vars.message); showAlerts(msgs, 'danger'); } } };*/ $('#form-628c8dee7919d').on('submit', function(e) { e.preventDefault(); $this = $('#form-628c8dee7919d').find("button[type=submit]"); var wdm_checkbox_val = 0; error_val= 0; if($this.attr('id') != 'mpeSendCustom') { id_send = $this.attr('id'); var id_array = id_send.match("btnSendCustom_(.*)"); if (jQuery("#" + id_send).closest('.row').siblings('.mpe_form_input').find("#contact-cc").is(":checked")) { wdm_checkbox_val = 'checked'; } } else { sendRequestToUpdateCart(false, false); if ( jQuery("#contact-cc").is(":checked") ) { wdm_checkbox_val = 'checked'; } } if (validInput == true && error_val == 0) { variation_id = ''; variation_detail = []; var $variation_id_obj = ''; // Select variation Id element using setting value. $variation_id_obj = jQuery(wdm_data.variation_id_selector); // If variation Id element is not found. if ($variation_id_obj.length == 0) { $variation_id_obj = $('.variation_id'); if ("undefined" != typeof id_array) { $variation_id_obj = $('#wdm-quoteup-trigger-' + id_array[1]).closest('.summary.entry-summary').find('.variation_id:first-child'); } } if ($variation_id_obj.length>0) { variation_id = $variation_id_obj.val(); $('select[name^=attribute_]').each(function(ind, obj){ name = $(this).attr('name'); name = name.substring(10); variation = name + " : " + $(this).val(); variation_detail.push(variation); }); } quantity =1; if($('input[name="quantity"]').length>0) { quantity =$('input[name="quantity"]').val(); } $form_data = new FormData(); $form_data.append('action', 'submitCustomForm'); $form_data.append('submitform[variation_id]', variation_id); $form_data.append('submitform[variation_detail]', variation_detail); $form_data.append('submitform[product_quant]', quantity); $form_data.append('submitform[cc]', wdm_checkbox_val); var checkbox_names = {}; //Loop Through all input fields $('#form-628c8dee7919d').find(':input').each(function(){ if($(this).attr('type') == 'file') { var attachedFiles = $(this).prop('files'); if(attachedFiles && attachedFiles.length > 0) { $(attachedFiles).each(function(index, value){ $file = value; $file_size = $file.size; // $form_data.append( index, $file ); $form_data.append( $file.name, $file ); }); } } else if($(this).attr('type') == 'checkbox') { //Proceed only if checkbox is checked if( !$(this).is(':checked') ){ return true; } if($(this).attr('id') == 'contact-cc') { return true; } let name = $(this).attr('name'); let current_value = $(this).val(); //Check if we have already started collecting current checkbox group if(!(name in checkbox_names)) { checkbox_names[name] = current_value; } else { checkbox_names[name] = checkbox_names[name] + "," + current_value; } } else if($(this).attr('type') == 'radio') { //Proceed only if radio is checked if( !$(this).is(':checked') ){ return true; } $form_data.append($(this).attr('name'), $(this).val()); } else if ($(this).hasClass("g-recaptcha-response")) { // If captcha version 2 and captcha field is visible. if(!$(this).closest('div.form-group').is(":hidden")) { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } } else if ($(this).hasClass('wdm-int-tel-input')) { // If phone number field. let iti = window.intlTelInputGlobals.getInstance(this), phoneNumber = iti.getNumber(), name = $(this).attr('name'); $form_data.append(name, phoneNumber); } else { name = $(this).attr('name'); value = $(this).val(); $form_data.append(name, value); } }); //append all checkboxes in $form_data for (let name in checkbox_names) { $form_data.append(name.replace('[]', ''), checkbox_names[name]); } // $('#form-628c8dee7919d').find('select').each(function(){ // name = $(this).attr('name'); // value = $(this).val(); // $form_data.append(name, value); // }); $('#wdm-cart-count').hide(); let form_selector = '#form-628c8dee7919d'; let $cookieConField = $(form_selector + ' input#cookie-consent-cb'); if($cookieConField.length > 0 && $cookieConField.is(":checked")) { let cname = $(form_selector + ' input[name="submitform[custname]"]').val(); let cemail = $(form_selector + ' input[name="submitform[txtemail]"]').val(); fun_set_cookie(cname, cemail); } else{ fun_remove_cookie(); } if(typeof quoteup_captcha_data != 'undefined' && 'v3' == quoteup_captcha_data.captcha_version){ // captcha v3 let site_key = quoteup_captcha_data.site_key; grecaptcha.execute(site_key, {action: 'quoteup_captcha'}).then(function(token) { $form_data.append('g-recaptcha-response', token); submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); }); } else { submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide, set_show); } } else { msgs = new Array(); msgs.push(err_string == '' ? quoteup_cf_err_msg.validation_err_msg : err_string); if (jQuery('.g-recaptcha').length > 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } return false; }); }); }); function submitEnquiryFormAjax($form_data, $this, this_part_id, validInput, id_array, set_hide,set_show) { $.ajax({ type: 'POST', url: 'https://naturallytimber.com.au/wp-admin/admin-ajax.php', data: $form_data, contentType: false, processData: false, dataType: 'json', // async: false, cache: false, beforeSend: function() { submit_btn_text = $this.html(); $this.html(" Please wait"); $this.prop('disabled', true); }, // pre-submit callback success: function(response) { msgs = new Array(); $('#spinner').remove(); $this.html(submit_btn_text); $('#'+this_part_id).css(set_hide); $('#form_part_0').css(set_show); $this.prop('disabled', false); if (response['action'] == 'success' && validInput === true) { msgs.push(response['message']); showAlerts(msgs, 'success'); if($('.wdm-quoteup-woo').length>0) { jQuery('.quoteup-quote-cart').slideUp(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function(){ $('.success').slideDown(); $('html, body').animate({ scrollTop: $("#success").offset().top - 700 }, 0); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 150); } else { $this.closest('.wdm-quoteup-form').hide(); $('#success_' + id_array[1]).show(); /** * Use this trigger event to perform the actions/ manipulations before * the enquiry form is hidden when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessBeforeFormHidden', [ $this, $form_data ]); setTimeout(function() { id = $this.attr('id'); number = id.match("btnSendCustom_(.*)"); modal_id = "#wdm-quoteup-modal-" + number[1]; jQuery(modal_id).modal('hide'); jQuery('.wdm-quoteup-form').css('display', 'none'); jQuery('.wdm-modal-footer').css('display', 'none'); jQuery('#error').css('display', 'none'); jQuery('#nonce_error').css('display', 'none'); jQuery('#success_' + number[1]).css('display', 'none'); /** * Use this trigger event to perform the actions/ manipulations after * timeout when enquiry is successful. * * @param object $this The jQuery object of the button clicked to submit the form. * @param object $form_data Object of FormData containing the form values. */ jQuery(document).trigger('quoteupEnquirySuccessAfterTimeout', [ $this, $form_data ]); }, 2000) } if(window.ga && ga.create) { for (i=0; i 0){ grecaptcha.reset(); } showAlerts(msgs, 'danger'); } } }); } function conditionalHandling() { $('.conditioned').each(function(){ var cur_field_id = $(this).attr('id'); cur_conditioned_fields = $(this).attr('data-cond-fields'); cur_cond_fields = cur_conditioned_fields.split('|'); var form_fields_wrapper = $(this).closest('#form_part_0'); for (i=0 ; i<cur_cond_fields.length ; i++) { var cond_field = cur_cond_fields[i].split(':'); let cond_field_0 = cond_field[0]; let cond_field_2 = cond_field[2].replace(/([!"#$%&'()*+,./:;[email protected][\]^`{|}~])/g, "\\$1"); if ($('#'+cond_field_0).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_0), cur_field_id, form_fields_wrapper); } if ($('#'+cond_field_2).length>0) { addConditionClass(form_fields_wrapper.find('#'+cond_field_2), cur_field_id, form_fields_wrapper); } } form_fields_wrapper.find('.cond_filler_'+cur_field_id).each(function(){ let curr_field_obj = $(this); applyRule(cur_field_id); // If current field is 'checkbox', 'radio' or 'select' field, then add 'change' // event on the field. if (curr_field_obj.attr('type') == 'checkbox' || curr_field_obj.attr('type') == 'radio' || curr_field_obj.is('select')) { $(this).on('change', function(){ applyRule(cur_field_id); }); } else if (curr_field_obj.attr('type') == 'text' || curr_field_obj.is(':input')) { curr_field_obj.on('keyup', function(){ applyRule(cur_field_id); }); curr_field_obj.on('focusout', function(){ applyRule(cur_field_id); }); if ('undefined' != typeof curr_field_obj.attr('id') && 'Rating_' == curr_field_obj.attr('id').match(/^Rating_/)) { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } } else { curr_field_obj.on('change', function(){ applyRule(cur_field_id); }); } }); }); } $(document).ready(function($){ conditionalHandling(); }); function showAlerts(msgs, type, form) { if(form === undefined) { form = ''; } $('.formnotice').slideUp(); alert_box = '<!-- --><!-- -->'; for (i = 0; i < msgs.length; i++) { alert_box += '' + msgs[i] + ''; if(form != '') { form.closest('form').append(alert_box); } else { $('#form-628c8dee7919d').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'); } for(let objsElement of objs) { comp_res = false; $cmp1 = $(objsElement).val(); for(let testElement of test) { $cmp2 = $(testElement).val(); if ($cmp1 != $cmp2) { comp_res = true; // return; } else if(areOperandsCb) { comp_res = false; break; } } if(areOperandsCb && true == comp_res) { break; } } 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_]')) { 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 '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<this_conditions.length ; i++) { var this_condition = this_conditions[i].split(':'), $form_part_0 = null; cmp_id = this_condition[0]; cmp_objs = null; $form_part_0 = $(this).closest('#form_part_0'); if (cmp_id.indexOf('Checkbox_') == 0 || cmp_id.indexOf('Radio_') == 0) { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id).find(':checked'); } else { cmp_objs = $(this).closest('#form_part_0').find('#'+cmp_id+' :input'); } cmp_operator = this_condition[1]; cmp_value = this_condition[2]; tmp_res = compareRule(cmp_objs, cmp_operator, cmp_value, cmp_id, $form_part_0); if (this_action[1] == 'all') cmp_res = cmp_res && tmp_res; else cmp_res = cmp_res || tmp_res; } if (cmp_res == true) { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide');//$('#'+field_id).addClass('hide'); } } else { if(this_action[0] == 'show') { $(this).closest('#form_part_0').find('#'+field_id).addClass('hide'); } else { $(this).closest('#form_part_0').find('#'+field_id).removeClass('hide'); } } }); } });
'; } alert_box += 'Thank You!