Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Without seeing any code, the simplest way you can do this is by using an onclick event for the radio buttons which would update the form action property. A crude example would be:</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;form onsubmit="submitForm();" id="myForm" type="get"&gt; &lt;input type="radio" name="myRadio1" data-op="0" value="10" onclick="calcNow();" selected /&gt;Monthly&amp;nbsp; &lt;input type="radio" name="myRadio1" data-op="1" value="120" onclick="calcNow();" /&gt;Annually&lt;br/&gt; &lt;input type="radio" name="myRadio2" data-op="0" value="10" onclick="calcNow();" selected /&gt;Option A&amp;nbsp; &lt;input type="radio" name="myRadio2" data-op="1" value="20" onclick="calcNow();" /&gt;Option B&lt;br/&gt; &lt;input id="myCheckbox" name="myCheckbox" type="checkbox" value="10" onclick="calcNow();" /&gt;Add-on&lt;br/&gt; &lt;input id="myTotal" name="myTotal" type="text" value="" disabled="disabled" /&gt;&lt;br/&gt; &lt;input type="button" id="myButton" onclick="submitForm();" value="Continue" /&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; var pages = [[["page1.html","page2.html"],["page3.html","page4.html"]],[["page5.html","page6.html"],["page7.html","page8.html"]]]; function calcNow() { var cb = document.getElementById("myCheckbox"); var cost1 = getRadioValue("myRadio1"); var cost2 = getRadioValue("myRadio2"); var cost3 = cb.checked ? parseInt(cb.value) : 0; var costTotal = cost1 + cost2 + cost3; document.getElementById("myTotal").value = costTotal; var op1 = getRadioData("myRadio1", "op"); var op2 = getRadioData("myRadio2", "op"); var op3 = cb.checked ? 1 : 0; if (op1 != undefined &amp;&amp; op2 != undefined &amp;&amp; op3 != undefined) { return pages[op1][op2][op3]; } return undefined; } function submitForm() { var page = calcNow(); if (page != undefined) { // ---- To popup ---- //alert(page); // ---- To navigate ---- location.href = page; // ---- To alter post ---- //var form = document.getElementById("myForm"); //form.action = page; //form.submit(); } else { alert("Please answer all questions."); } } function getRadioValue(name) { var controls = document.getElementsByName(name); for (var i = 0; i &lt; controls.length; i++) { if (controls[i].checked) { return parseInt(controls[i].value); } } return 0; } function getRadioData(name, attribute) { var controls = document.getElementsByName(name); for (var i = 0; i &lt; controls.length; i++) { if (controls[i].checked) { return parseInt(controls[i].dataset[attribute]); } } return undefined; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Note that this is quite basic html and javascript, so if you are having troubles with this you may need to get in touch with a web designer. This part is the easy bit!</p>
    singulars
    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.
    1. This table or related slice is empty.
    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