so I have a project that I’m working on.. When I have a certain drop down option or radio button selected, I want the form to redirect to unqualified.html.. Otherwise, I want the form to redirect to qualified.html. I mostly do work in Java, so wrapping my head around JavaScript has been a challenge.. I’m not allowed to use any libraries or jquery for this project.
Here’s my form:
<form method="post" id="linkId" onClick="reDirect()" action=''>
<div class ="formContent">
<label for="email"><b>Business Email</b></label><br>
<input type="email" class="tArea" placeholder="Enter your business email" style="width:350px;" formaction="qualified.html" required><br>
</div>
<div class="formContent">
<label for="businessSize" style="padding-top: 5%;"><b>Business Size</b></label><br>
<select class="tArea" id="selectbox" style="width:359px;" required>
<option value ="" disabled selected hidden>Select Size</option>
<option value="1-10" id="unqualified1">1-10</option>
<option value="11-50">11-50</option>
<option value="51-100">51-100</option>
<option value="101-250">101-250</option>
<option value="250-1000">250-1000</option>
<option value="1000+">1000+</option>
</select>
</div>
<div class="paddedContent">
What is the most important thing to you in a solution?
</div>
<div class="radioForms">
<input type="radio" name="radBtn" required><label>Real-time Analytics</label>
<input type="radio" name="radBtn" class="rightRadio1" id="unqualified2"><label>Scalability</label><br>
<input type="radio" name="radBtn"><label>Query Response Time</label>
<input type="radio" name="radBtn"><label>Document Storage</label><br>
<input type="radio" name="radBtn"><label>High concurrency</label>
<input type="radio" name="radBtn" class="rightRadio2" id="unqualified3"><label>Full Text Search</label><br>
<input type="radio" name="radBtn"><label>Fast Data Digest</label>
<input type="radio" name="radBtn" class="rightRadio3" id="unqualified4"><label>Price</label><br>
<br>
<input type="submit" class="submitBtn" value="Continue to Schedule a Time ➟">
</div>
</form>
And here’s my reDirect() method:
function reDirect()
{
if(document.getElementyById('unqualified1').clicked)
document.getElementById('linkId').action = "unqualified.html";
else if (document.getElementyById('unqualified2').checked)
document.getElementById('linkId').action = "unqualified.html";
else if (document.getElementyById('unqualified3').checked)
document.getElementById('linkId').action = "unqualified.html";
else if (document.getElementyById('unqualified4').checked)
document.getElementById('linkId').action = "unqualified.html";
else
document.getElementById('linkId').href = "qualified.html";
}
Whenever an input within the form is selected with the id=”unqualified1″, id=”unqualified2″, id=”unqualified3″, or id=”unqualified4″ I want the form to direct users to “unqualified.html” when submitted, otherwise I want it to direct users to “qualified.html”
If anyone has any helpful tips or can see where I’m going wrong with this, I’d greatly appreciate it.