Note that there are some explanatory texts on larger screens.

plurals
  1. POChange form from select dropdown field to radio button and keep functionality
    primarykey
    data
    text
    <p>I have a form which redirects users depending on their selection of a group of <code>select</code> elements. I'm trying to convert this to use radio buttons instead of select lists, but retain the original functionality.</p> <pre><code> &lt;form&gt; &lt;p&gt;option1 &lt;/p&gt; &lt;select id="option1"&gt; &lt;option value="0" id="Select"&gt;Select&lt;/option&gt; &lt;option value="1" id="coffee"&gt;Coffee&lt;/option&gt; &lt;/select&gt; &lt;p&gt;option2&lt;/p&gt; &lt;select id="option2"&gt; &lt;option value="0" id="Select"&gt;Select&lt;/option&gt; &lt;option value="1" id="White"&gt;White&lt;/option&gt; &lt;option value="2" id="Black"&gt;Black&lt;/option&gt; &lt;/select&gt; &lt;p&gt;option3&lt;/p&gt; &lt;select id="option3"&gt; &lt;option value="0" id="Select"&gt;Select&lt;/option&gt; &lt;option value="1" id="std"&gt;STD&lt;/option&gt; &lt;option value="2" id="300"&gt;300&lt;/option&gt; &lt;option value="3" id="500"&gt;500&lt;/option&gt; &lt;/select&gt; &lt;p&gt;option4&lt;/p&gt; &lt;select id="option4"&gt; &lt;option value="0" id="Select"&gt;Select&lt;/option&gt; &lt;option value="1" id="america"&gt;America (NT - ST)&lt;/option&gt; &lt;option value="2" id="australia"&gt;Australia and Oceania&lt;/option&gt; &lt;/select&gt; &lt;br&gt;&lt;br&gt; &lt;input onclick="goToPage();" type="button" value="Submit" /&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; function goToPage() { var option1 = document.getElementById("option1").value; var option2 = document.getElementById("option2").value; var option3 = document.getElementById("option3").value; var option4 = document.getElementById("option4").value; if (option1==1 &amp;&amp; option2==1 &amp;&amp; option3==1 &amp;&amp; option4==1) { window.location = "http://www.testint.com/us"; } else if (option1==1 &amp;&amp; option2==2 &amp;&amp; option3==3 &amp;&amp; option4==2) { window.location = "http://www.testing.com/au"; } } &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload