CausesValidation not working with custom validators

Sunny

I have custom validators on the aspx page and user needs to see the error message in summary as soon as they tab out of the control.

To achieve this, I am calling Page_ClientValidate('') on onblur event of each control. One of the custom validator I have is:

function ValidateCustomerId(oSrc, args) {
    var txtCustomerId = document.getElementById(txtCustomerId);

    if (txtCustomerId != null) {
        var customerId = txtCustomerId.value;

        if (!isInteger(customerId)) {
            document.getElementById("customerIdAsterik").style.display = 'inline';
            args.IsValid = false;
        }
        else {
            document.getElementById("customerIdAsterik").style.display = 'none';
        }
    }
}

If user enters invalid entry and clicks on Cancel button, server side event is not getting fired untill it is clicked twice. Cancel button already has CausesValidation=false. I think this behaviour is due to calling on Page_ClientValidate() on onblur event, otherwise it works fine.

Is there to skip the client validations when they click on cancel button or is there any approach I could take to achieve this.

gbs

Similar kind of issue is listed here: http://weblogs.asp.net/gurusarkar/archive/2013/05/30/after-first-postback-why-i-have-to-click-the-button-twice-for-postback-to-occur.aspx

Not sure if that applies but the Validation is fired due to the onblur.

So I think setting that Page_Block=false in the button click might work.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Django Custom Validators Not Working

From Dev

CustomValidator not working with other validators

From Dev

CustomValidator not working with other validators

From Dev

Testing custom validators with Minitest

From Dev

Spring MVC custom validators

From Dev

Proptypes custom validators with Flow

From Dev

The Validators And Errors Are Not Working In Angular 9

From Dev

Custom validators in WTForms using Flask

From Dev

Angular 4 : Validators.pattern() not working

From Dev

Abstract Factory for custom Validators - options discarded?

From Dev

(Laravel) How to add errors in custom validators?

From Dev

Creating dependant custom validators for form inputs?

From Dev

Custom Angular Validators- Passing an Argument

From Dev

Create custom validators for dynamic forms angular 2

From Dev

Angular 4 - Using Asynchronous custom validators

From Dev

ZF2 Annotation Validators NotEmpty and Int not working?

From Dev

Spring MockMVC - How to mock custom validators running outside of controllers

From Dev

Do you have to register your custom validators in symfony

From Dev

JSR303 custom validators being called twice

From Dev

ServiceStack Map Errors in ResponseStatus to custom Errors without Validators

From Dev

Angular 2 form validation with custom validators ng-valid class

From Dev

How do I add custom validators in JOI 17?

From Dev

Spring MockMvc - Custom Validators are not registered/called in Spring Container

From Dev

Spring MockMVC - How to mock custom validators running outside of controllers

From Dev

AngularJS Form custom validation. Cannot read property '$validators' of undefined

From Dev

Tests fail with custom jsr validators with @Inject for Spring boot application

From Dev

Angular 2 form validation with custom validators ng-valid class

From Dev

Django: Python path syntax to my custom validators.py?

From Dev

How to use custom validators of github.com/1000hz/bootstrap-validator

Related Related

  1. 1

    Django Custom Validators Not Working

  2. 2

    CustomValidator not working with other validators

  3. 3

    CustomValidator not working with other validators

  4. 4

    Testing custom validators with Minitest

  5. 5

    Spring MVC custom validators

  6. 6

    Proptypes custom validators with Flow

  7. 7

    The Validators And Errors Are Not Working In Angular 9

  8. 8

    Custom validators in WTForms using Flask

  9. 9

    Angular 4 : Validators.pattern() not working

  10. 10

    Abstract Factory for custom Validators - options discarded?

  11. 11

    (Laravel) How to add errors in custom validators?

  12. 12

    Creating dependant custom validators for form inputs?

  13. 13

    Custom Angular Validators- Passing an Argument

  14. 14

    Create custom validators for dynamic forms angular 2

  15. 15

    Angular 4 - Using Asynchronous custom validators

  16. 16

    ZF2 Annotation Validators NotEmpty and Int not working?

  17. 17

    Spring MockMVC - How to mock custom validators running outside of controllers

  18. 18

    Do you have to register your custom validators in symfony

  19. 19

    JSR303 custom validators being called twice

  20. 20

    ServiceStack Map Errors in ResponseStatus to custom Errors without Validators

  21. 21

    Angular 2 form validation with custom validators ng-valid class

  22. 22

    How do I add custom validators in JOI 17?

  23. 23

    Spring MockMvc - Custom Validators are not registered/called in Spring Container

  24. 24

    Spring MockMVC - How to mock custom validators running outside of controllers

  25. 25

    AngularJS Form custom validation. Cannot read property '$validators' of undefined

  26. 26

    Tests fail with custom jsr validators with @Inject for Spring boot application

  27. 27

    Angular 2 form validation with custom validators ng-valid class

  28. 28

    Django: Python path syntax to my custom validators.py?

  29. 29

    How to use custom validators of github.com/1000hz/bootstrap-validator

HotTag

Archive