I thought myRadioButton.value would work but value doesn't come up as an option I can select. If I select nodevalue the value of that during runtime is null. "No" should be selected by default but I'm not sure how to bring up that value in my javascript code. What am I missing?
<script type="text/javascript">
function TextValidation(oSrouce, args) {
var myRadioButton = document.getElementById('<%= rblUserEquip.ClientID %>');
var myTextBox = document.getElementById('<%= txtEmpName.ClientID %>');
alert("Test" + myRadioButton.value);
if (myRadioButton.value == "no")
{
alert("Test2");
if (myTextBox.value == "")
{
args.IsValid = False;
alert("Employee name empty");
return false;
}
else
args.IsValid = True;
}
else
{
args.IsValid = True;
alert("Test3");
}
}
</script>
<asp:RadioButtonList ID="rblUserEquip" runat="server">
<asp:ListItem Value="yes" Text="Yes"></asp:ListItem>
<asp:ListItem Value="no" Text="No" Selected="True"></asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="txtEmpName" runat="server" ></asp:TextBox>
<asp:CustomValidator runat="server" ID="cvEmpName" ClientValidationFunction="TextValidation" Display="Dynamic" text="*" ErrorMessage="Please fill TextBox" ></asp:CustomValidator>
<cc1:ValidatorCalloutExtender ID="vceSymptoms" runat="server" TargetControlID="cvEmpName"></cc1:ValidatorCalloutExtender>