/** * 2007-2017 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2017 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ $(document).ready(function(){ $('#id_type_contact_form').on('change',function(){ var id_type_contact_form = parseInt($(this).val()); if(id_type_contact_form>0) { var selected = $(this).find('option:selected').data('questions'); $('#id_qus_contact_form').html(''); $('.main-form-contact-us').hide(); $( "#id_qus_contact_form" ).append( ''); $.each(selected, function(i, item) { $( "#id_qus_contact_form" ).append( ''); }); $('.questions-select').show(); $('.id_type_contact_form_error').hide(); } else { $('.questions-select').hide(); $('.answer-for-main-question').hide(); $('.main-form-contact-us').hide(); $('.id_type_contact_form_error').show(); } }) $('#id_qus_contact_form').on('change',function(){ var id_qus_contact_form = parseInt($(this).val()); var id_type_contact_form = parseInt($('#id_type_contact_form').val()); if(id_qus_contact_form>0) { $('.answer-for-main-question').hide(); $('#answer-'+id_type_contact_form+'-'+id_qus_contact_form).show(); $('.main-form-contact-us').show(); $('.id_qus_contact_form_error').hide(); } else { $('.answer-for-main-question').hide(); $('.main-form-contact-us').hide(); $('.id_qus_contact_form_error').show(); } }) $('#submitMessageContactCustom').on('click',function(){ var id_qus_contact_form = parseInt($('#id_qus_contact_form').val()); var id_type_contact_form = parseInt($('#id_type_contact_form').val()); if(id_type_contact_form<=0) { $('.id_type_contact_form_error').show(); return false; } else if(id_qus_contact_form<=0) { $('.id_qus_contact_form_error').show(); return false; } }) })