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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:09:30+00:00 2026-05-24T16:09:30+00:00

I use a custom AJAX vtype, which works and all. However I notice the

  • 0

I use a custom AJAX vtype, which works and all.
However I notice the extjs docs note that

“Note: this method does not cause the Field’s validate or isValid methods to return false if the value does pass validation. So simply marking a Field as invalid will not prevent submission of forms submitted with the Ext.form.action.Submit.clientValidation option set.”

How does one mark a field as invalid so that form.isValid() returns false?
My vtype:

Ext.apply(Ext.form.VTypes, {
username: function(value, field){        
    var conn = new Ext.data.Connection();
    conn.request({
        url: 'test.php',
        params:{email:value},
        method: 'POST',

        success: function(responseObject){
            var resp = responseObject.responseText;
            if (resp == 0) {
                field.markInvalid('This email is invalid or already registered!');                
            } else if (resp == 1) {
                field.clearInvalid();
            }
        },
        failure: function(){                
           Ext.Msg.show({title: 'Error', msg: 'Connection error!',});
        }
    });
    return true;
}
});
  • 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-24T16:09:31+00:00Added an answer on May 24, 2026 at 4:09 pm

    Well, if you look at the definition of clientValidation:

    Determines whether a Form’s fields are validated in a final call to
    isValid prior to submission. Pass false in the Form’s submit options
    to prevent this. If not defined, pre-submission field validation is
    performed.

    This is basically saying, if its set to false then the form will be automatically validated prior to submission… at which point it will fail if you have marked any fields as invalid. If you set it to true then you need to manually check if the form is valid before submitting.

    It’s worth pointing out that your AJAX vtype is never going to work. When the form calls the vtype to check whether the field is valid, all it gets in response is true… so the form submits no matter what. Even if you tell it to return after the ajax request has completed, the form would submit before the vtype ajax request completes.

    A better solution would be to include the call to the vtype manually in your submit button handler…then in your success of the ajax request just do

    if(form.isValid()) {
       form.getForm().submit();
    }
    

    This will force the submit button’s click event to first validate the username field and then, and only then, will it submit the form.

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

Sidebar

Related Questions

Use jquery + php. Doing custom AJAX captcha. i.e user clicks on image, it
To use custom layout file in my app I'm using this following code, set
I am using custom ajax-called javacode that does some processing on the server. In
Is it possible to use a custom HTTP VERB, like MERGE, with jQuery.ajax()? I'm
I'm trying to use jQuery to call some custom API via Ajax/$.getJSON . I'm
In a custom ASP.NET AJAX control, i have this to do some repositioning. var
I currently use custom error codes when something goes wrong with my Jquery Ajax
I'm currently working on an AJAX site where we use custom HTML tags to
I build a custom AuthenticationSuccessHandler so users can login using Ajax aswell use a
I was trying to write a custom caching mechanism for my ajax calls, which

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.