Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    Form redirect

    How-to, Tutorials
    3
    4
    395
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      Ed Low last edited by

      Hello, I have a short form section on my web page where I would like to redirect the user to a specific URL upon clicking the submit button. The form has only 1 question, with the answers in <select><option> format. Once the customer decides on what option they want to choose and click submit, the page should be able to read the value of the option seleted by the user and redirect them to the corresponding URL. For example: option A --> a.html; option B --> b.html

      May I know how I can go about doing that? Thank you

      The website is https://www.1010media.sg/ . The form is right above the "Our Films" part

      1 Reply Last reply Reply Quote 0
      • Daniel Mulroy
        Daniel Mulroy last edited by

        Great Question!

        I have an answer for you. There a few different ways of doing it, but this is what I thought might be simplest. 3 easy steps!

        1. Select your dropdown element and open the paintbrush. Go to "Identification" at the bottom and give it the ID of "service_selector"
        Screen Shot 2021-03-15 at 7.06.24 PM.png

        2. Again on the dropdown element, modify each of your options so that their "Placeholder" remains the same, but the 'Value' becomes the name of the page you want to redirect to (the part that would appear in the URL).

        For example, for the page "https://www.1010media.sg/stocklibrary.html", you would enter "stocklibrary.html"

        Screen Shot 2021-03-15 at 7.12.36 PM.png

        3. On your 'Send' button, click Action -> Javascript, and paste the following one line of code and save:

        window.location.href = "/"+$("#service_selector select")[0].value;
        

        That's it! That one line of Javascript will get the 'value' of the option selected, which corresponds to the filename you want them to visit. Then, it tells the browser to navigate to that page. I love when things are simple and easy 🙂

        Good luck, let us know if you need any more help.

        1 Reply Last reply Reply Quote 2
        • Wassim
          Wassim last edited by

          In addition to @Daniel-Mulroy explanation, if you use a form, for the 3rd step you need to go to

          e1517a50-2259-4393-aee1-54141ca5390b-image.png

          4d268029-678d-421b-9e50-af181d820fe3-image.png

          and set the JS code he provided

          1 Reply Last reply Reply Quote 1
          • E
            Ed Low last edited by

            I manged to get it work with the simple steps you provided. Thank you very much!

            1 Reply Last reply Reply Quote 2
            • First post
              Last post