?
Solved

Question on the ClientValidationFunction of CustomValidator

Posted on 2006-07-19
3
Medium Priority
?
705 Views
Last Modified: 2011-10-03
function B works as expected. However function A always invalidate the checkbox status (it always think that the checkbox is unchecked.)

Anyone may offer some ideas?

function A:
function ValidateChkLegalText(sender, args)
{    var e = document.getElementById('<% =ChkLegalTextClientID %>');
    args.IsValid = e.Checked;
}

function B:
function ValidateChkLegalText(sender, args)
{
    args.IsValid = document.getElementById('<% =ChkLegalTextClientID %>').checked;
}

                        <asp:CheckBox ID="chkLegalText" runat="server"
                            Text="Checkbox text goes here."
                            ValidationGroup="Approve"  />

            <asp:CustomValidator ID="custValidatorChkBox" runat="server" ErrorMessage="Error: Checkbox is required." ValidationGroup="Approve" ClientValidationFunction="ValidateChkLegalText" Display="None"></asp:CustomValidator><br />
0
Comment
Question by:chuang4630
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
adathelad earned 2000 total points
ID: 17138717
Hi chuang4630,

Could be that as Javascript is case sensitice you need "checked" with a lowercase c in function A, as per function B:
args.IsValid = e.checked;
0
 
LVL 1

Author Comment

by:chuang4630
ID: 17138946
Hmm, let me try
0
 
LVL 1

Author Comment

by:chuang4630
ID: 17138966
Yah, you are right.

Thanks.
0

Featured Post

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question