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 8831253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:16:06+00:00 2026-06-14T08:16:06+00:00

I have a page, where I want to log every validation message which the

  • 0

I have a page, where I want to log every validation message which the user failed to meet the requirements the associated field.

The problem is my postback/button click never occurs (maybe because of clientside validation), and therefore the logging never takes place before the user actually got every field right (no validation errors).

The button click event method:

protected void btnNext_Click(object sender, EventArgs e)
{
    Page.Validate();
    if(Page.IsValid)
    {
        //code
    }
    else
    {
        foreach (IValidator validator in Validators)
        {
            if (!validator.IsValid)
            {
                PageValidatorErrors error = new PageValidatorErrors
                              {
                                  WebsiteID = AppState.WebsiteID,
                                  Page = Request.Url.AbsolutePath,
                                  URL = Request.Url.ToString(),
                                  UserIP = Tools.GetIP(),
                                  ErrorMessage = validator.ErrorMessage,
                                  CreatedDate = DateTime.Now
                               };
                pageValidatorErrorsRep.insert(error);
            }
        }
    }
}

Any ideas, how I could log theese messages?

Edit:

<script type="text/javascript">
    function validatePage()
    {
        if (window.Page_IsValid != true)
        {
            //Page_Validators is an array of validation controls in the page. 
            if (window.Page_Validators != undefined && window.Page_Validators != null)
            {
                //Looping through the whole validation collection. 
                for (var i = 0; i < window.Page_Validators.length; i++)
                {
                    window.ValidatorEnable(window.Page_Validators[i]);

                    //if condition to check whether the validation was successfull or not. 
                    if (!window.Page_Validators[i].isvalid)
                    {
                        var errMsg = window.Page_Validators[i].getAttribute('ErrorMessage');
                        alert(errMsg);
                    }
                }
            }
        }
    }
</script>
  • 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-06-14T08:16:07+00:00Added an answer on June 14, 2026 at 8:16 am

    Here is part of the solution, you can get the validates/true false by invoking it client side:

    http://razeeb.wordpress.com/2009/01/11/calling-aspnet-validators-from-javascript/

    function performCheck()
    {
    
    if(Page_ClientValidate())
    {
    
    //Do something to log true/ false
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a login in my admin page. Now I want to log every
I have a page that I want to update non stop, every few seconds.
I have a page in which I want to maintain the value of object
I have an onbeforeunload event handler attached to the page which executes every time
I have this page: I want to capture on which div I am while
I have a log in page which is the home page so is located
I have a page that I want to be styled differently depending on whether
I have an html page i want to print a portion of this html
I have a search page and want to add some filters to it, my
I want to have a page redirect to another. Here is the situation: I

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.