Custom Validator

B

brian

I am trying to implement a custom validator Client Side.
I have the server side code working fine. I place the
below script below the body tag outside the <form> tag.

My if statement actually contains about 5 conditions.
The bigest thing is I want to dynamically configure the
error message. If I take out the object.ErrorMessage
= "TEST" then the control will pick up on the invalid
entry but I have no message displayed.

<Script language="vbscript" runat="server">
Sub ValidText(sender as object, arg as
servervalidateeventargs)
IF Not isnumeric(arg.value) then
arg.isvalid = false
object.ErrorMessage = "Test"
end if
end sub

Does anyone know how to dynamcially display an error
message.

Thanks
 
P

Peter Blum

Are you getting an error at runtime that 'object does not contain the
property ErrorMessage' (or something like that?)
You did not typecast 'object' to CustomValidator.

CType(object, CustomValidator).ErrorMessage = "Test"

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 
B

brian shannon

Thanks for your reply. Yes that is the error I get. Would I do the
type cast in the vbscript? CType(object, CustomValidator).ErrorMessage
= "Test"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top