Custom control not validating

The input parameter is a form control, and the output is either an error object or null if the value is valid.

So here is what that method would look like: The above code defines our directive that implements the Validator interface.

I had already found out that the standard approach (args.value) doesn't work because the value isn't sent to the function from these controls.

I found the following example on a forum somewhere but it only works when the script is in the ascx file. I tried your code just as it was (but with the Data Binder set to one of my DB columns) but got the same error as I had when I had previously tried this myself.

For anybody else copying this, please not that the snippet Princy supplied needs a small modification.

The client validation function property on the custom validator should read: Princy, OK, well you've solved my problem so thanks again.

The error I get is: "Microsoft JScript runtime error: 'client Unit Price Validation' is undefined".

The above form would be invalid as long as the user does not enter a credit card number that passes our validation criteria.

Now let’s add some error handling to render the right error message from our validator function: My name is Alain Chautard.

With a passion for Angular, Type Script and Java Script, Todd leads the online courses creation and has written hundreds of articles on front-end web development and beyond.

He specialises in breaking down complex topics and understands the critical mission of learning new technology fast, comprehensively and the right way.

Search for custom control not validating:

custom control not validating-35custom control not validating-36

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “custom control not validating”