Skip to content

Commit

Permalink
Fixed #112 bug with mutiple selects
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Aug 13, 2019
1 parent 3e9a435 commit 5cf2b66
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Resources/public/js/be_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var renameElement = function(element) {
'[' + attributes.join('*="' + oldName + '"],[') + '*="' + oldName + '"]'
).each(function(el) {
attributes.each(function(attribute) {
if (el.get(attribute)) {
if (el.get(attribute) && el.get(attribute).split(oldName).length > 1) {
el.set(attribute, el.get(attribute).split(oldName).join(newName));
}
});
Expand Down Expand Up @@ -155,16 +155,16 @@ var persistSelects = function(element) {

$(element).getElements('select').each(function(select) {

var option = select.getElement('option:selected') || select.getElement('option');
var oldOption = select.getElement('option[selected]');
var options = select.getElements('option:selected');
var oldOptions = select.getElements('option[selected]');

if (oldOption) {
oldOptions.each(function (oldOption) {
oldOption.removeAttribute('selected');
}
});

if (option) {
options.each(function (option) {
option.setAttribute('selected', '');
}
});

});

Expand Down

0 comments on commit 5cf2b66

Please sign in to comment.