We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10997
    • 27 Posts
    I hope this is the right forum. Please move if I am wrong.

    What I want to do is use the value of a <select> input in a form on a document to navigate to the selected form.

    I’ve got the <select> set up so that the ’value’ is the document ID. I know I can pass that value via POST, GET, etc to a snippet on a ’receiving’ page. What I don’t understand is how to ’call’ MODx to show the selected document.

    Basically I have a list of documents in the <select> drop-down, and want to have the user be able to ’select’ the page, hit the <submit> button and have MODx show the page.

    If someone could point me in the right direction, it would be greatly appreciated.

    Thanks!
      • 10449
      • 956 Posts
        • 10997
        • 27 Posts
        Yep. Just like that!

        Now, I wonder if there is a way to do this w/o using Javascript? That’s not really my forte(Insomuch as I can’t write Javascript cool ).

        However, this will work great, and thank you so much for pointing me in that direction. Much appreciated!!
          • 4310
          • 2,310 Posts
          This will work on clicking the select option.
          No need for a form submit button.
          <script type="text/javascript" language="JavaScript">
          function nav()
             {
             var w = document.qsearch.xfer.selectedIndex;
             var url_add = document.qsearch.xfer.options[w].value;
             window.location.href = url_add;
             }
          </script>
          <form id="qsearch" name="qsearch" >
          <fieldset id="qsearch" >
          <select name="xfer" size="1" onChange="nav()">
          <option selected value="Select country...">Select country...</option>
          <option value="Anguilla.html">Anguilla</option>
          <option value="BVI.html">BVI</option>
          <option value="Mexico.html">Mexico</option>
          <option value="Panama.html">Panama</option>
          <option value="Puerto-Rico.html">Puerto Rico</option>
          <option value="Thailand.html">Thailand</option>
          <option value="USA.html">USA</option>
          </select>
          </fieldset>
          </form>
          

          Simple yet effective, rather like me laugh