The idea is to create a javascript function that looks like this:
<script language='javascript'>
<!--
function MyFunction(source, args)
{
// write javascript logic that determines if there is a error
// set args.IsValid to true or false depending on if there is an error
}
-->
</script>
Assign the function name to the CustomValidator.ClientValidationFunction.
The hard part is figuring out the javascript logic. You will need to
specify the exact goals and related elements on the page for anyone to
help with that.
FYI: I built a replacement to Microsoft's validators that helps avoid most
client-side scripting issues. "Professional Validation And More"
(
http://www.peterblum.com/vam/home.aspx) includes 22 validators, all with
client-side support on many more browsers than Microsoft's supports. One
of the most powerful validators is the MultiConditionValidator. Use it to
combine the power of any of the validators in boolean expressions like
[TextBox1 is required and TextBox2 is required and TextBox2 must be a
valid date format].
--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
Lisa Calla said:
Hi,
I've been struggling with this for a few days. I've seen bits and pieces
(how to set up custom validation), but I can't seem to understand how to
get client side validation for my custom composite control (the textbox
part). I've done a ton of vbnet, am new to aspnet, but barely know how to
spell java. Anyone know of a good website or tutorial for this kind of
thing?
TIA