Being new to javascript, I’m way in over my head. But I’m trying 😛
Basically what I need to do is redirect to a url based on the options selected in the form below. There will be 4 checks in total.
- If Windows & Advanced are selected, redirect to A
- If Windows and Basic are selected, redirect to B
- If Mac and Basic are selected, redirect to C
- If Linux and Basic are selected, redirect to D
However, I’m not quite sure how I would be able to grab the specific names of each radio button and select option, let alone see if they are checked, and make the checks listed above.
If someone could point me in the right direction, it would be much appreciated. Thanks.
<form action="process_form.php" class="TTWForm" method="post" novalidate="">
<div id="field3-container" class="field f_100">
<label for="field3">Your Operating System</label>
<select name="field3" id="field3" required="required">
<option id="field3-1" value="Windows"> Windows </option>
<option id="field3-2" value="Mac"> Mac </option>
<option id="field3-3" value="Linux"> Linux </option>
</select>
</div>
<div id="field2-container" class="field f_100 checkbox-group required">
<label for="field2-1">Version</label>
<div class="option clearfix">
<input type="radio" name="field2[]" id="field2-1" value="Basic">
<span class="option-title"> Basic </span> <br>
</div>
<div class="option clearfix" id="optional">
<input type="radio" name="field2[]" id="field2-2" value="Advanced">
<span class="option-title"> Advanced </span> <br>
</div>
</div>
</form>
I would add a button, and do something on the submit of the form :
FIDDLE