I’m using the ajax toolkit’s ValidatorCalloutExtender to display error messages on a textbox. The ValidatorCalloutExtender is extending on a RegularExpressionValidator that is validating the textbox. The problem I am having is that I need to dynamically change the ValidationExpression and ErrorMessage depending on what dropdownlist item has been selected that is associated to the textbox. I was able to successfully do this using client side events and javascript but then I can’t seem to get the ValidatorCalloutExtender to update the ErrorMessage that is displayed properly. The thing that confuses me more is this works fine in Firefox but I can’t seem to get it to work in any version of IE. If anyone can help me find a way to get my error message that is displayed to change dynamically it would be greatly appreciated.
I’m using the ajax toolkit’s ValidatorCalloutExtender to display error messages on a textbox. The
Share
Ok everyone,
I figured out my own issue and thought I might put my findings out here if others are trying to do something similar to me.
In javascript I’m passing the object of the regularexpressionvalidator tied to a textbox, into a function that will change the regular expression and error message depending on a value in a drop down list. If a user changed the dropdownlist value I wanted the validator and ajax validatorcallout to update immediately and either tell the user that the value in the textbox was now valid or it was invalid but because of this new reason. I’m not saying this is the best way to do this but this is the way that works for me and I wanted to do it on the client.
below is the code that i’m using and (val) is the regularexpressionvalidator object that is passed in.
As you can see Internet Explorer didn’t work the same way as the rest of the browsers I tested against did! If someone has a better way of doing this please share, and I hope this answer helps some people out!
Thanks