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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:08:48+00:00 2026-05-30T23:08:48+00:00

I am trying to create a required field validation with a customvalidator. However when

  • 0

I am trying to create a required field validation with a customvalidator. However when the field is empty it still does a postback?

<body>
    <form id="Form1" runat="server">
    <h3>
        CustomValidator ServerValidate Example</h3>
    <asp:Label ID="Message" Font-Name="Verdana" Font-Size="10pt" runat="server" />
    <p>
        <asp:TextBox ID="Text1" runat="server" Text="[Name:required]" />
        &nbsp;&nbsp;
        <asp:CustomValidator ID="CustomValidator1" ControlToValidate="Text1" ClientValidationFunction="ClientValidate"
            Display="Static" ErrorMessage="" ForeColor="green" Font-Name="verdana" Font-Size="10pt"
            runat="server" />
        <p>
            <asp:Button ID="Button1" Text="Validate" OnClick="ValidateBtn_OnClick" runat="server" />
    </form>
</body>
</html>
<script language="javascript">
    function ClientValidate(source, arguments) {
        alert(arguments.Value.length);
        if (arguments.Value != "[Name:required]" && arguments.Value.length > 0) {
            arguments.IsValid = true;
        } else {
            arguments.IsValid = false;
        }
    }
</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-05-30T23:08:49+00:00Added an answer on May 30, 2026 at 11:08 pm

    Add ValidateEmptyText="True" to your CustomValidator tag

    See here for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a bespoke form in drupal, with a node reference field.
I'm trying to create an Editor Template for a DateTime field and it does
Trying to create a very piece of validation to prevent spammers. I want a
I'm trying to create a fairly simple form that has a few checkboxes and
I'm trying to create a custom field for a ModelForm. I'm extending from ModelMultipleChoiceField
I'm a complete rails rookie and i'm trying to create validation for a contact
I am trying to create an form validator class that will check to make
I am trying to create a new custom validation in which I can compare
I'm trying to create a search form that posts the results queried from a
I'm trying to create a form in Django. That works and all, but 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.