G
Guest
I am trying to use the following script to see determine whether a
dropdownlist has a value in it or to see whether a checkbox has been checked.
I don't want the user to be able to do both. In other words I don't want a
user to check a checkbox and choose an item from a drop-down list box. I
want them to do one action or the other.
Here is my script to try and do this but im not sure if my logic is correct
as I get an error no matter what I do. Can someone please help me.
<script language=javascript>
function ValidateDropDownOrCheckBox(sender, args)
{
if ( document.WebForm2.DropDownList1.value ||&&
document.WebForm2.CheckBox1.checked )
{
args.IsValid = true;
return;
}
else
args.IsValid = false;
}
</script>
This is how I refer to this script
<asp:CustomValidator id="cvRepApp" runat="server" Font-Size="Medium"
ErrorMessage="Must enter either or"
ClientValidationFunction="ValidateDropDownOrCheckBox">*</asp:CustomValidator>
Thanks for any help anyone can give me
dropdownlist has a value in it or to see whether a checkbox has been checked.
I don't want the user to be able to do both. In other words I don't want a
user to check a checkbox and choose an item from a drop-down list box. I
want them to do one action or the other.
Here is my script to try and do this but im not sure if my logic is correct
as I get an error no matter what I do. Can someone please help me.
<script language=javascript>
function ValidateDropDownOrCheckBox(sender, args)
{
if ( document.WebForm2.DropDownList1.value ||&&
document.WebForm2.CheckBox1.checked )
{
args.IsValid = true;
return;
}
else
args.IsValid = false;
}
</script>
This is how I refer to this script
<asp:CustomValidator id="cvRepApp" runat="server" Font-Size="Medium"
ErrorMessage="Must enter either or"
ClientValidationFunction="ValidateDropDownOrCheckBox">*</asp:CustomValidator>
Thanks for any help anyone can give me