JS валидация индекса

Основной текст заметки

В файле js/validate.js переделана функция

function validate_field(that)
{
if ($(that).hasClass('is_required') || $(that).val().length)
{
var result;

if ($(that).attr('data-validate') == 'isPostCode')
{
var selector = '#id_country';
if ($(that).attr('name') == 'postcode_invoice')
selector += '_invoice';

var id_country = $(selector + ' option:selected').val();

if (typeof(countriesNeedZipCode[id_country]) != 'undefined')
result = window['validate_'+$(that).attr('data-validate')]($(that).val(), countriesNeedZipCode[id_country], null);
else
if (typeof(countries[id_country]) != 'undefined')
result = window['validate_'+$(that).attr('data-validate')]($(that).val(), null, countries[id_country]['iso_code']);

}
else if($(that).attr('data-validate'))
result = window['validate_' + $(that).attr('data-validate')]($(that).val());

if (result)
$(that).parent().removeClass('form-error').addClass('form-ok');
else
$(that).parent().addClass('form-error').removeClass('form-ok');
}
}

Заметка написана: 15.12.2018

Теги заметки: Bug, PrestaShop, PrestaShp 1.6