Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About Niku

  • Rank
    Jr. Member

Profile Information

  • Gender

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you @Robin S! I made these changes based on your reply and now it works: // Adding values from: $addonSelect.children('[value="' + valueToSelect + '"]').attr('selected', true).end().change(); // to: $addonSelect.children('[value="' + valueToSelect + '"]').prop('selected', true).end().change(); // Removing values from: $addonSelect.children().removeAttr('selected').end().change(); // to: $addonSelect.children().prop('selected', false).end().change(); So I switched from attr() to prop(). Lesson learned: do not use attr(), use prop().
  2. I'm trying to manipulate selections for asmSelect allowing multiple selections with js. The code is basically like this: $('#mySelect').change(function(){ var asmSelect = $('#Inputfield_asmselectfield'); asmSelect.children("option").attrRemove('selected'); if ($(this).val() == 1) { asmSelect.children('option[value="foo"]').attr('selected', true); } if ($(this).val() == 2) { asmSelect.children('option[value="bar"]').attr('selected', true); } asmSelect.change(); }); #mySelect is a InputfieldSelect, #Inputfield_asmselectfield is the asmSelect field. This works for first time an option is selected in asmSelect, but second round fails. Select 1 from #mySelect "Foo" shows up as selected Select 2 from #mySelect "Foo" goes away, "Bar" shows up Select 1 from #mySelect "Bar" goes away. "Foo" does NOT show up. Any ideas how to get this to work for more than one round?
  3. I ran into this same issue with triggers 'trash' and 'restore'. I was trying to do stuff before page is trashed/restored. I saw weird behavior but it took a good while until I understood triggers were being triggered multiple times per request. My use case: I need to communicate with REST API when page changes. Running triggers multiple times is an issue as it leads to unexpected results. I had to go around the issue with class properties, but I don't think that should be the case. I assumed addHookBefore('Pages::restore'...) would be run once.
  • Create New...