PricingBlog

Form Dropdown - options from API response

  • stockton_f-1163294456775184485

    Stockton

    2 years ago

    How can I have a dropdown form input, but the options for the dropdown come from the response of an API response?

    Bonus if I can have multiple dropdowns that get data from separate APIs including chaining.

    For example: dropdown 1 uses api1 to get options.

    Dropdown 2 uses the selection from dropdown 1 to return a list of new options from api2 for dropdown 2.
    2
  • stockton_f-1163491641550708806

    Stockton

    2 years ago

    I got the dropdown to work as a repeater based on results of the API. However, how do I use the selected value for future tasks (buttons, more apis, etc.)

    Something about finding the index value of the selected item and returning the corresponding key or something like that.
  • ilan83-1164674053664157747

    Ilan

    2 years ago

    I was looking for exactly this - did you figure it out?
  • stockton_f-1164681187978137630

    Stockton

    2 years ago

    Yeah yeah, I got it to work 🙂

    What are you looking to do exactly? I can try and help.
  • stockton_f-1164755560781074462

    Stockton

    2 years ago

    Alright, this is only the second time doing the select feature, but I made a video of me bumbling through it.

    15 mins long, but hey, starting somewhere.

    https://share.zight.com/X6unlZv4
    🔥3
  • tomthebigtree-1164843564430262293

    Tom Ireland

    2 years ago

    Awesome demo of leveraging select and multiple API calls. 🤘 As a quick tip, to duplicate an element, choose the one you want, hold Option/Alt on the keyboard and drag the element to the appropriate place to duplicate. 😉
    ❤️2
  • stockton_f-1164919478220492913

    Stockton

    2 years ago

    Thank you master 🙇‍♂️
  • Tod-1164919479780778035

    Tod

    2 years ago

    Great energy @Stockton! Your continuous contribution to the toddle Community just made you advance to Community Level 2!
  • ilan83-1165933897868120084

    Ilan

    2 years ago

    @Stockton thank you so much! I finally got my form running that is awesome
  • Tod-1165933899357106207

    Tod

    2 years ago

    Great energy @Ilan! Your continuous contribution to the toddle Community just made you advance to Community Level 2!
  • sellsy.-1239575895900033105

    sellsy

    2 years ago

    Thanks for the demo. Do you think its possible to apply it to this kind of functionality ?
  • lucasg-1239589122243432698

    Lucas G

    2 years ago

    Yes, you can.
  • lucasg-1239589628973940776

    Lucas G

    2 years ago

    Have a div repeat with the list and use a search input that filters the array of results
  • Assuming you have a defined list you want to search through
  • sellsy.-1239641525986525216

    sellsy

    2 years ago

    Thanks Lucas. Actually the list is populated via an API. I think I need to create a popover to create the dropdown...?
  • lucasg-1239644288082513960

    Lucas G

    2 years ago

    I just made a div that repeats over the list and it shows while the search input is in focus
  • Basically onClick or focusin then show and on focusout hide
  • For my use case, clicking one of the results also closes the results list but for you that could depend on whether or not you want the user to choose one or multiple, etc
  • sellsy.-1239645108647886868

    sellsy

    2 years ago

    Nice thanks I will give that a go
  • alexsiale_17363-1239658302871437322

    Alex

    2 years ago

    This whole thread is gold. Saving this!