title: Create page redirects on form submission from specific checked radio buttons using javascript
body: <p>Apologies straight away for this shoddy looking bit of code. I need a bit of help creating page redirects when a form is submitted while a specific combination of radio buttons are selected or checked. The actual form I am working on is set so it needs to be use javascript. I have a simplified example to show what I have done so far. </p>
  
  <pre><code>&lt;html&gt; First Question?&lt;br&gt;
  &lt;label&gt;Yes&lt;input type="radio" name="1" id="1" value="1"&gt;&lt;br&gt;&lt;/label&gt;
  &lt;label&gt;No&lt;input type="radio" name="2" id="2" value="2"&gt;&lt;br&gt;&lt;/label&gt;
  Second Question?&lt;br&gt;
  &lt;label&gt;Yes&lt;input type="radio" name="3" id="3" value="3"&gt;&lt;br&gt;&lt;/label&gt;
  &lt;label&gt;No&lt;input type="radio" name="4" id="4" value="4"&gt;&lt;br&gt;&lt;/label&gt;
  
  &lt;/br&gt;
  &lt;input type="submit"&gt;
  &lt;script&gt;
      onFormSubmit: (function sum($form) {
  
          var ab = document.getElementById("1");
          var bc = document.getElementById("2");
          var cd = document.getElementById("3");
          var de = document.getElementById("4");
  
          var ef = (ab) &amp;&amp; (bc);
          var fg = (ab) &amp;&amp; (cd);
          var gh = (ab) &amp;&amp; (de);
  
          if ($form.find("ef").prop("checked")) {
              window.location.href = "url 1"
          } else if ($form.find("fg").prop("checked")) {
              window.location.href = "url 2"
          } else if ($form.find("gh").prop("checked")) {
              window.location.href = "url 3"
          else {
              window.location.href = "url 4"
          }
  
      });
  &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I have tried a few things. This is where I have ended up. Each time I manage to get something working but it just defines the first id and not based on a combination of selected ids etc. I want to eventually expand the form for more questions but my main aim is to get this working first.</p>
  
  <p>Many thanks for the help in advance and once again apologies for this feeble excuse for javascript. J</p>