Damon wrote:
I'd like to be able to modify the error message of an ASP.NET 2.0
customValidator on the fly, depending on what part of the validation
failed. Now, the client validation function takes two parameters, the
second of which points to the value to be validated (args.Value). I
can't seem to locate what exactly the first parameter points to, and
trying to debug the Javascript in Visual Studio 2005 and figure this
out is problematic at best.
Is it possible to reference the ErrorMessage field of the
customValidator, or will I *shudder* need to roll my own custom field
validation?
*bump*
Still having trouble with this.
Here's my javascript validation code for one of the fields. This isn't
the final form of the validation, though. I want to check more stuff
but I need to get this question answered first.
function validateEditClient(val, args) {
args.IsValid = (args.Value.length > 0) && (args.Value.length <=
100);
if (!(args.IsValid)) {
document.getElementById('ctl00_ContentPlaceHolder1 _DetailsView1_txtEditClient').style.backgroundColo r='red'
} else {
document.getElementById('ctl00_ContentPlaceHolder1 _DetailsView1_txtEditClient').style.backgroundColo r='white'
};
}
I know what to do with the "args" parameter. But where, oh where is
there any documentation on what's being passed in the "val" parameter??
I want to be able to use it to programmatically reference the text
that's contained in the ErrorMessage property (or alternatively the
Text property) of the customValidator object. How can I do this?
Damon