Hi change,
There are actually two parts to your question here; assiging a value from a radio button & validating your form.
If you want to assign a value to the variable sLine then you need to submit your form back to the same page and request the value of the radio button. Here is an example:
thispage.asp: -
<%
-
Dim sLine
-
sLine = request.form("line_type")
-
%>
-
<form name="form1" action="thispage.asp" method="post">
-
<input type ="radio" name="line_type" value="isdn">isdn</input>
-
<input type ="radio" name="line_type" value="lse">lse</input>
-
<input type="submit" value="Submit" />
-
</form>
-
If you want to add some validation (in this case checking whether a radio button has been selected) then you could use some javascript. You could add something like this in between your head tags:
-
-
<script type="text/javascript">
-
function RadioChecked()
-
{
-
var checked = false;
-
for (var i=0;i<document.form1.line_type.length;i++)
-
{
-
if (document.form1.line_type[i].checked)
-
{
-
checked = true;
-
}
-
}
-
if (checked == true)
-
{
-
return true;
-
}
-
else
-
{
-
alert('No option selected')
-
return false;
-
}
-
}
-
</script>
-
-
Then add OnClick="return RadioChecked();" to your submit button.
The above script loops through all the check boxes in the list and returns a value of 'true' to your form if it finds one that is checked, allowing it to submit.
Does this all make sense? Let me know how it goes,
Best regards,
Dr B