diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index b4d913bffd104c147e6521df48549a335590d1eb..c993837f1bc4ed6fc5d739eed9fcdd282056c404 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -225,21 +225,20 @@ function InitManagementForType() { let type_hidden_field = form.querySelectorAll('select[name="type"]'); type_hidden_field.forEach(function(select_hidden) { options_hidden = select_hidden.getElementsByTagName("option"); - for (let option_hidden of options_hidden) { - option_hidden.removeAttribute("selected"); - str = option_hidden.value - - if (str.substr(str.length - 10) == 'types/1/"}') { - - //Actually selecting the option if it is the good one - option_hidden.setAttribute("selected", "selected"); - select_hidden.setAttribute("value", option_hidden.value); + for (let option_hidden of options_hidden) { + option_hidden.removeAttribute("selected"); + str = option_hidden.value + + if (str.substr(str.length - 10) == 'types/1/"}') { + //Actually selecting the option if it is the good one + option_hidden.setAttribute("selected", "selected"); + select_hidden.setAttribute("value", option_hidden.value); + } } - } - //Trigerring a reload of the associated form - let parent_form = select_hidden.closest("sib-form"); - parent_form.component.inputChange(); - refreshPagination(); + //Trigerring a reload of the associated form + let parent_form = select_hidden.closest("sib-form"); + parent_form.component.inputChange(); + refreshPagination(); }); }); }, @@ -360,14 +359,12 @@ function manageSelectLanguage() { if (uriLanguage.substr(uriLanguage.length - 14) == 'languages/1/"}') { //Redirection with the appropriate prefixe. var redirect = "http://"+base_url+'/fr/'+pathAfterThePrefix - document.location.href = redirect - } else { + } + else { var redirect = "http://"+base_url+'/en/'+pathAfterThePrefix document.location.href = redirect - } - }) } }