// fix on front validators

This commit is contained in:
Rémi Gaillard
2013-11-04 19:26:51 +01:00
parent 8dc29b20f0
commit 569455a7ff
+9 -11
View File
@@ -22,14 +22,12 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
$(document).ready(function() { $(document).on('keyup', 'input.validate, textarea.validate', function() {
$('input.validate, textarea.validate').on('keyup', function() { if ($(this).hasClass('is_required') || $(this).val().length)
if ($(this).hasClass('is_required') || $(this).val().length) {
{ if (window['validate_'+$(this).attr('data-validate')]($(this).val()))
if (window['validate_'+$(this).attr('data-validate')]($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok');
$(this).parent().removeClass('form-error').addClass('form-ok'); else
else $(this).parent().addClass('form-error').removeClass('form-ok');
$(this).parent().addClass('form-error').removeClass('form-ok'); }
} });
});
});