Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Contributor
2674 Points
1040 Posts
Apr 24, 2007 12:03 AM|LINK
So I made a working bit of code (javascript) to validate a Terms Of Use checkbox.
When the checkbox and CustomValidator are inside The "CreateUserWizard" form It won't work.
Outside it, there's no problems. My code is:
<asp:CheckBox ID="AcceptTermsCheckBox" runat="server" Text=" I agree to the Detelli Property Network"
And my javascript code, that I can only place outside the "CreateUserWizard" form, is:
<script language="javascript" type="text/javascript">
{
args.IsValid = document.getElementById(
}
I've been trying to write some Visual Basic in the code behind that I can use,
but it's not working, no matter what I do it pulls up the error as though the checkbox is unchecked.
Protected Sub ValTermsCheckBox_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
Dim AcceptTermsCheckBox As CheckBox = CreateUserWizardStep1.Controls(0).FindControl("AcceptTermsCheckBox")
If AcceptTermsCheckBox.Checked = True Then
args.IsValid =
This is really leaving me stumped, any ideas would be greatly appreciated.
Thank you in advance
darkknight18...
Contributor
2674 Points
1040 Posts
CreateUserWizard Check Box validation Problem
Apr 24, 2007 12:03 AM|LINK
So I made a working bit of code (javascript) to validate a Terms Of Use checkbox.
When the checkbox and CustomValidator are inside The "CreateUserWizard" form It won't work.
Outside it, there's no problems. My code is:
<asp:CheckBox ID="AcceptTermsCheckBox" runat="server" Text=" I agree to the Detelli Property Network"
Font-Size="8" ForeColor="#133792" ValidationGroup="CreateUserWizardControl" /><br /> <asp:HyperLink runat="server" NavigateUrl="Terms.aspx" ForeColor="#133792" Font-Underline="true" ID="Terms" Font-Size="8">terms of use.</asp:HyperLink><br /> <asp:CustomValidator ID="ValTermsCheckBox" ClientValidationFunction="AcceptTermsCheckBoxValidation" runat="server" ErrorMessage="Please accept Terms and Conditions." ValidationGroup="CreateUserWizardControl" OnServerValidate="ValTermsCheckBox_ServerValidate"> </asp:CustomValidator>And my javascript code, that I can only place outside the "CreateUserWizard" form, is:
<script language="javascript" type="text/javascript">
function AcceptTermsCheckBoxValidation(source, args){
args.IsValid = document.getElementById(
'<%= AcceptTermsCheckBox.ClientID %>').checked;}
</script>I've been trying to write some Visual Basic in the code behind that I can use,
but it's not working, no matter what I do it pulls up the error as though the checkbox is unchecked.
Protected Sub ValTermsCheckBox_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
Dim AcceptTermsCheckBox As CheckBox = CreateUserWizardStep1.Controls(0).FindControl("AcceptTermsCheckBox")
If AcceptTermsCheckBox.Checked = True Then
args.IsValid =
True End If End SubThis is really leaving me stumped, any ideas would be greatly appreciated.
Thank you in advance
Please remember to mark the post as answer that solves your issue.
This will be greatly benificial for other users.