Selectfield problem in Safari

  • francomelanieh-1330861634507509800

    Nico

    19 days ago

    Hey guys, i have a problem using safari in my toddle project.
    i populate a selectfield with options from a api call (works)
    then i "set" the value based on another api call - this works in chrome very well, but doesent set the value using safari.

    i allready tried to prevent the default styling of select elements in safari, but it doesent change that strange behavior.

    any ideas?
  • lucasg-1330947366823657596

    Lucas G

    19 days ago

    How are you setting it?
  • By set I assume you mean set the selected value
  • If so, using the selected attribute should work on all browsers
  • francomelanieh-1330975809648726036

    Nico

    19 days ago

    This is my setup on the "option" of the select field
    1330975809405714512-Bildschirmfoto_2025-01-20_um_20.02.20.png
  • lucasg-1330979755503255632

    Lucas G

    19 days ago

    Selected attribute is set on load of the element. It doesn’t dynamically update after.
    If you want to update it after then you’ll need to use a custom action
  • It is used to set a default option when the element loads but it doesn’t change when the user selects an option
  • So if you want to update the selected value, you use a custom action to update the select element to show the option with the value that you want
  • Does that make sense
  • francomelanieh-1330981867478057041

    Nico

    19 days ago

    i will look into that tomorrow but i think it makes sence yes! i just dont get why it works on chome and even sometimes works in safari, but not allways 😄
  • thank you very much @Lucas G
  • lucasg-1330982209733132352

    Lucas G

    19 days ago

    Likely because sometimes the call happens quickly enough to set it but not always
  • That would be my assumption
  • francomelanieh-1330982544119955497

    Nico

    19 days ago

    that makes sense
  • Tod-1330982545889689764

    Tod

    19 days ago

    Great energy @Nico! Your continuous contribution to the toddle Community just made you advance to Community Level 7!
  • lucasg-1330983102004203670

    Lucas G

    19 days ago

    I've used this in the past:
  • function resetSelect (args) {
    let selectElement = document.getElementById(args.elementID);
    selectElement.value = args.value ?? "";
    }

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code — but accessible to your entire team!

Try toddle — it's free!

© Copyright 2024 toddle. All rights reserved.