Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Validation Controls

Status
Not open for further replies.

barrylowe

Programmer
Nov 6, 2001
188
GB
I have a text box on my form which is used to enter a reference number. It has 2 validation controls attached to it. The first is a standard required validator, the second is a custom validator which runs a little bit of code that checks to see if the reference that has been entered already exists.

The controls sit side by side on my form in the following order:

Textbox RequiredValidator CustomValidator

Both validators work fine, the problem is that if it is the Custom validator that is triggered, then there is a gap between the text box and the validation error message where the unseen required validator is hiding.

Can anyone help?
 
A quick fix would be to get rid of the RequiredValidator and build that logic into your custom validator! Otherwise, you may have to use javascript/CSS to position the elements based on whether they are shown or not.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I tried doing that but the code in the custom validator does not fire unless a value has been entered in the text box which kind of defeats the purpose.
 
Change the ValidateEmptyText property of the custom validator to True
 
I can't seem find that property of the validator control. I am running framework v.1.1, is that property part of v.2.0?
 
Yes (see my first post). You could either use the CustomValidator and add a client-side function to check for a empty value or you could use the second suggestion I offerered.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top