Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 619077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:36:57+00:00 2026-05-13T18:36:57+00:00

I have two questions regarding client-side validation in ASP, relating to the following setup:

  • 0

I have two questions regarding client-side validation in ASP, relating to the following setup:

I have this bit of javascript which applies error styles to form elements if they fail to validate:

        var val = Page_ClientValidate();

        if (!val) {
            var i = 0;
            for (; i < Page_Validators.length; i++) {
                if (!Page_Validators[i].isvalid) {
                    $("#" + Page_Validators[i].controltovalidate).parent().removeClass("valid").addClass("invalid");
                } else {
                    $("#" + Page_Validators[i].controltovalidate).parent().removeClass("invalid").addClass("valid");
                }
            }
        }

        return val;

The call to parent() is referencing an asp:Panel, which encompasses each individual form element and its validators. My problem is that, if I assign more than one validator to a control, and the first validator fails but the second passes, the ‘valid’ style is applied last due to order of operations. I have two questions regarding this. It’s important to note that I am extremely new to JavaScript, and have previously just been abusing postbacks to do all my validation.

Question #1:

Is there a good documentation source for client-side validation? I can’t seem to find anything. For example, where does this Page_ClientValidate() call come from? What other calls can I make? What about Page_Validators? What members exist in controltovalidate? Are there any? Is it just a DOM element? I know what I want to do in my head to solve this problem:

get parent

valid = true

for each validator in parent
    if validator does not validate
        valid = false
        break

if valid
    apply valid style
else
    apply invalid style

But I don’t even know how I can do this. So, again, is there any good documentation I can use to solve this problem myself?

Question #2:

Assuming I get a good answer to #1, I’ll figure this out myself but…

How do I do what I described in the pseudo-code above, or is it not possible in the manner I’ve laid out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:36:57+00:00Added an answer on May 13, 2026 at 6:36 pm

    Question #1: MSDN is a great source of information on this, start here.

    Question #2: Try this approach:

        var val = Page_ClientValidate();
    
        if (!val) {
            $(".invalid").removeClass("invalid"); //Remove invalids
            var i = 0;
            for (; i < Page_Validators.length; i++) {
                if (!Page_Validators[i].isvalid) {
                    $("#" + Page_Validators[i].controltovalidate).parent().removeClass("valid").addClass("invalid");
                } else {
                    $("#" + Page_Validators[i].controltovalidate).parent(":not(.invalid)").addClass("valid");
                    //Only apply to those not already invalid
                }
            }
        }
    
        return val;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions regarding array: First one is regarding following code: int a[30];
I have two questions regarding this code. What does the double*** pdata and int***
The following code should be self explanatory. I have two questions regarding the used
I have two questions regarding my script and searching. I have this script: $searchTerms
I actually have two questions regarding the same problem but I think it is
I actually have two questions regarding exception/error handling in the iPhone app that I
I have two questions: 1) How can I make an array which points to
I have two questions regarding the multidimensional arrays. I declared a 3D array using
I have two questions regarding ceil() function.. The ceil() function is implemented in C.
I have two questions regarding binary search trees, both about empty trees. Is an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.