CustomValidator for Radio Button

R

Ricky Williams

I have a CustomValidator for a Radio Button that works fine with IE, but
doesn't trigger with Firefox or Netscape.

I have been stuck on this one for 3 weeks; any suggestions greatly
appreciated.

Thanks!

<script language="javascript">
function ValidateRadiobutton(oSrc, args) {
if(document.getElementById("<%=rbChoiceA.ClientID%>").checked == false
&&
document.getElementById("<%=rbChoiceB.ClientID%>").checked ==
false){
args.IsValid = false;
}
}
</script>

<asp:CustomValidator id="vld1PaymentType"
ClientValidationFunction="ValidateRadiobutton" runat="server"
ErrorMessage="Payment Type must be selected"
CssClass="ValidationMessage"></asp:CustomValidator>
 
P

Peter Blum

Hi Ricky,

The ASP.NET 1.x validators do not support client-side validation on anything
but DHTML browsers (IE and IE/Mac). *always* create validation on the server
side to handle cases where the browser doesn't get supported or has
javascript turned off.

ASP.NET 2.0 and my Professional Validation And More
(http://www.peterblum.com/vam/home.aspx) both support client-side validation
on more browsers than the original ASP.NET 1.x validators.
In my Professional Validation And More, there are 25 validators including
those that can detect the rules you've described below (use my
CheckStateValidator and MultiConditionValidator).

--- Peter Blum
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top