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

Ask A Question

Stats

  • Questions 299k
  • Answers 299k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I suppose because the ECMA 334 standard say: array-initializer: {… May 13, 2026 at 7:49 pm
  • Editorial Team
    Editorial Team added an answer <div style="text-align: justify"><span>My name is</span><span>ABC</span></div> Pretty simple, the spans will… May 13, 2026 at 7:49 pm
  • Editorial Team
    Editorial Team added an answer First, let me say that there is always another alternative,… May 13, 2026 at 7:49 pm

Related Questions

I'm trying to code what I think is a fairly routine AJAX pattern using
I have a very simple query (three where conditions; two equals, one between) from
I have a capture card that captures SDI video with embedded audio. I have
I'm relatively new to the whole AJAX way of doing things so please excuse
I'm writing a Java application that will instantiate objects of a class to represent

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.