Wednesday, 14 February 2007

ValidatorCallout and CustomValidators

We have adopted the ValidatorCallout Ajax control toolkit because it looks very smart, and we are using a custom validator to ensure that the same item isn't getting added twice to the database using server side validation.

Problem: The validator callout doesn't appear - the server side validation does prevent the insert from happening, but no message is displayed to the user!

Solution: The only solution unfortunately is to implement your code using client side validation (aka javascript). I don't have time to implement the required script for each custom validator, so we have dropped the ValidatorCallout for all server side validation.

This is a known issue on the controls page known issues section:
The callouts do not currently display automatically after a server post-back
and will only work for custom validators which utilize client-side validation.
Even after a post-back the callout will display when the form is re-validated
when a postback is attempted again.
I suppose it makes sense for it not to work, but its a bit of a shame that it doesn't.

So Validator callout will only work for client side validation (works great for all the other validators, just not the custom validator)!

Enjoy

Ross

2 comments:

Asheesh said...

This has been fixed in changeset 30991.

http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=6460

Cheers
Asheesh Soni

Neha said...
This comment has been removed by the author.