views:

145

answers:

1

Hi,

Is it possible to get a reference to the textbox that the customvalidator is 'attached' to in javascript?

I want to place a red border around the texbox if it fails validation.

A: 

Your javascript validation function will have access to "sender" and "args" parameters. The control that is being validated may be accessed from the "sender" as follows.

function doValidation(sender, args)
{
    alert(sender.attributes["controltovalidate"].value);
}
chrissr
WOW! Thanks :-)
Sir Psycho
No problem. It took me a while to figure out that one when I needed it myself.
chrissr