Billybonga
IS-IT--Management
Hi,
I'm unsure if this is a Javascript or ASP question but hopefully someone here can help.
I have a dynamic form that holds a Radio Button.
Depending on the number of records in the database you have have 2-7 options/radio buttons to select from.
From a programming perspective my form code looks like :
I want to validate if an option has been selected so I have the following Javascript
For some reason this doesn't work -- but if it set
optSecenek.checked = true the form upon submit does tell me that there is no option selected, even if there is or isn't one selected.
Is it possible to do this or does having a dynamic radio button prevent it from being done ?
I am able to validate the form in the cast.asp page(when the page is submitted) using :
but i'd prefer to validate the form before posting.
Thanks for your help
Billybonga
I'm unsure if this is a Javascript or ASP question but hopefully someone here can help.
I have a dynamic form that holds a Radio Button.
Depending on the number of records in the database you have have 2-7 options/radio buttons to select from.
From a programming perspective my form code looks like :
Code:
<form onSubmit="return ProgressBar();" action="cast.asp?ID=<%=lAnketID%>" method="post" name="survey" id="survey">
<td colspan="3" class="smalltext"> <input type="radio" name="optSecenek" value="<%=rs("OptionID")%>">
<input type="submit" name="cmdOyVer" value="Submit" class="flatbutton">
</form>
I want to validate if an option has been selected so I have the following Javascript
Code:
<SCRIPT>
function ProgressBar(){
if (document.survey.optSecenek.checked = false){
alert("Please select an option");
return false;
}
}
</SCRIPT>
For some reason this doesn't work -- but if it set
optSecenek.checked = true the form upon submit does tell me that there is no option selected, even if there is or isn't one selected.
Is it possible to do this or does having a dynamic radio button prevent it from being done ?
I am able to validate the form in the cast.asp page(when the page is submitted) using :
Code:
if lSecenekID = 0 then '' If the customer hasn't selected an option then warn them
%>
<p class="smalltext"> <strong><font color="#000000">Please
select an option.</font></strong><br>
<a href="<%=request("http_referer")%>">Go back</a>
<%
response.end
end if
but i'd prefer to validate the form before posting.
Thanks for your help
Billybonga