Client side validation with PropertyProxyValidator

Topics: General discussion, Pre-release discussions, Validation Application Block
Feb 1, 2007 at 9:54 PM
Hello!

In an aspx page, does anyone know if it´s possible to validate a control with PropertyProxyValidator in client side, like the VS2005 validators controls?
Every time I submit data in an aspx page, the data is sent to the server. The validation is not made in the browser, although EnableClientScript is "true".

Thanks,
Marcos
Feb 1, 2007 at 11:30 PM
Hi Marcos -

Unfortunately this isn't possible with the current implementation. In fact it won't ever be possible to do the validation on the client side (without a major implementation change), since validators are .NET objects and don't include any javascript validation logic.

However, we have discussed (but didn't get time to implement yet) an AJAX-style solution which provide most of the benefits of client-side validation without requiring major changes. I found an article that does a good job at describing the basic approach, although it's not even .NET based, at http://particletree.com/features/degradable-ajax-form-validation/. You could probably roll your own solution like this on top of the existing ASP.NET VAB adapter, and we'll almost certainly get to this eventually.

Tom
Feb 7, 2007 at 7:09 PM
Thank´s Tom.

AJAX is great solution, however I´m afraid maybe it´s not the best solution for me.
The fact is that my aspx forms has too many fields, so each component changed will submit something to the server, which will cause some overhead in the sytems, as the application has dozens of users.
My solution was:
- Implemented custom validators that make public the getter´s for important attributes.
- Each one of this new validatorAttribute is wrapped by some Decorator, which automatically create .net Validators in the aspx, depending on the Attribute type.

i.e: a CustomNotNullValidatorAttribute is decorated by NotNullValidatorDecorator, that creates RequiredFieldValidator as child on some CompositeControl. So, using web custom controls, I verify the Attributes of a PropertyName and .net Validation controls are created automatically.

Marcos
Feb 7, 2007 at 10:28 PM
http://www.codeplex.com/ValidationFramework seemed to figure out client side validation pretty well.
Mar 21, 2007 at 1:50 AM
not supporting client side validation would be a major drawback of using the block. I think I'll have a look at the validation framework. Thanks for the link.