From 229b023dad6fea7394631a664374cf655185d6c0 Mon Sep 17 00:00:00 2001 From: Pierre RAMBAUD Date: Thu, 18 Oct 2018 18:07:30 +0200 Subject: [PATCH] Improve regex --- .../themes/default/js/bundle/product/form.js | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/admin-dev/themes/default/js/bundle/product/form.js b/admin-dev/themes/default/js/bundle/product/form.js index f8ce9ca6df9f0..e93735006471b 100644 --- a/admin-dev/themes/default/js/bundle/product/form.js +++ b/admin-dev/themes/default/js/bundle/product/form.js @@ -398,7 +398,7 @@ var featuresCollection = (function() { if('' !== $(this).val()) { $.ajax({ - url: $(this).attr('data-action').replace(/\/\d+(?=\?.*)?$/, '/' + $(this).val()), + url: $(this).attr('data-action').replace(/\/\d+((?=\?.*))?/, '/' + $(this).val()), success: function(response) { $selector.prop('disabled', response.length === 0); $selector.empty(); @@ -644,7 +644,7 @@ var form = (function() { //update the customization ids if (typeof response.customization_fields_ids != "undefined") { $.each(response.customization_fields_ids, function (k, v) { - $("#form_step6_custom_fields_" + k + "_id_customization_field").val(v); + $("#form_step6_custom_fields_" + k + "_id_customization_field").val(v); }); } @@ -742,23 +742,23 @@ var form = (function() { } function updateMissingTranslatedNames() { - var namesDiv = $('#form_step1_names'); - var defaultLanguageValue = null; - $("input[id^='form_step1_name_']", namesDiv).each(function(index) { - var value = $(this).val(); - // The first language is ALWAYS the employee language - if (0 === index) { - defaultLanguageValue = value; - } else if (0 === value.length) { - $(this).val(defaultLanguageValue); - } - }); + var namesDiv = $('#form_step1_names'); + var defaultLanguageValue = null; + $("input[id^='form_step1_name_']", namesDiv).each(function(index) { + var value = $(this).val(); + // The first language is ALWAYS the employee language + if (0 === index) { + defaultLanguageValue = value; + } else if (0 === value.length) { + $(this).val(defaultLanguageValue); + } + }); } /** * Depending on the provided params, this method displays or hides * an error panel with the form errors not linked to a specific field. - * + * * @param {string} content The HTML content to display */ function updateDisplayGlobalErrors(content) {