CustomValidator not working [Resolved]

Posted by Balajikcp8 under ASP.NET on 8/6/2012 | Points: 10 | Views : 1806 | Status : [Member] | Replies : 2
Even i'm setting args.IsValid=false, form getting submitted

.aspx

<asp:CheckBox ID="CheckBox1" runat="server" />
<asp:CustomValidator ID="CustomValidator1" ClientValidationFunction="cbxvalidate"
runat="server" ErrorMessage="*"></asp:CustomValidator>

java script

function cbxvalidate(sender, args) {
if (document.getElementById('CheckBox1').checked == true) {
args.IsValid = 'true';
} else {
args.IsValid = 'false';
}
}




Responses

Posted by: Ogipansrk on: 8/7/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Balaji,

in your javascript code ....

change the following from

args.IsValid = 'true'; and args.IsValid = 'false';

to

args.IsValid = true;
args.IsValid = false;

// remove the quotes around the true and false

Balajikcp8, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Balajikcp8 on: 8/7/2012 [Member] Starter | Points: 25

Up
0
Down
Thank you

Balajikcp8, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response