We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Dropdown menu default option selected on page reload/refresh

Home Forums Puzzles Dropdown menu default option selected on page reload/refresh

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #56657
    Mariusz
    Customer

    In my configurator, the user can choose the country from a dropdown menu that was added via HTML puzzles – this function changes the texture on the flag. It all works fine. The parameter is saved in a link, so after reloading the page, the user can see the flag that he previously chose. But, the dropdown menu displays the “Default” option instead of a chosen country. I think I should somehow add “selected” to the “option” in HTML, to tell the code which dropdown menu should be displayed. But I don’t know how to do it with puzzles.

    In the attachment, I am adding my HTML configuration and a puzzle setup where I try to use the “replace text” puzzle to add this “selected” word. But it doesn’t work. Any ideas on how this could be done? Thank you!

    Attachments:
    You must be logged in to view attached files.
    #56660
    kdv
    Participant

    You can use this puzzle to set the default value for a selector.

    Btw, your replace with puzzles do nothing usefull. To make it work you should set a new innerHTML property using the result of the replace with puzzle.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #56665
    Mariusz
    Customer

    Oh my… “Set prop” puzzle. Of course! That was so obvious. :wacko: thank you! It works now. :good:

    #56666
    kdv
    Participant

    You’d better use this simple universal puzzle set instead of multiple else if

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #56670
    Mariusz
    Customer

    That’s clever, thank you! By the way, do those two different techniques impact the application’s performance anyhow? Besides lagging in the Verge3D puzzle viewport, of course.

    I mean, is there any difference in the app performance depending on whether I will use “else if” + “replace texture” 20 times, or whether I will use the universal puzzle configuration like above?

    When I started this project, I had no idea on how to create universal puzzles using a combination of text-replacing puzzles. So now, I have a loooooot of repetitive puzzle setups for different configurator options. I wonder if changing them all to universals is worth my time spent on this project since it’s a lot of work to do.

    #56671
    kdv
    Participant

    Nope, perfomance is not degraded, maybe slightly. It’s just the matter of code optimization and

    lagging in the Verge3D puzzle

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #56701
    Mariusz
    Customer

    Ok, good to know. Thanks!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.