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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validator help 1

Status
Not open for further replies.

Rexxx

MIS
Oct 16, 2001
47
I'm using a panel form and if a certain textbox has an entry then I need for another certain textbox to require an entry. This validator is to be I believe a client side validator so that tabbing through the form will display the error (i.e.,not the need to display the error by submission of the form).

I've looked at compare validator and not sure that will do. May need a custom validator. Can anyone help? I've tried developing a custom validator but having trouble. Can someone provide an example (using ASPX VB not C#)?
 
To do true custom client side validation takes a bit of massaging. I would suggest you read Isadore's FAQ on the subject... hers is specifically pointed towards calculations, but the same methodology can be applied to validation:

faq855-2291

paul
penny1.gif
penny1.gif
 
Rexxx:

Isadore's faq is a great start, but the validator controls in asp.net have one benefit over simply using javascript:
they validate on the server as well as the client. This is important if your user has javascript turned off in his browser (which would mean the validation code would never fire).

Your best bet (although it would require a postback, but not necesarily a "submit" in the sense of a button click) might be to hide the second text box, and only show it if the first text box's TextChanged events shows that there is text in there.

Then, you could have a required validator for that text box (I 'believe' that the validator would only fire if the control is visible, but you'd have to prove that theory...I would, but I'm not at my work computer ;) ).

Thats a start in the right direction anyway. Personally, I think you're definately better off with the validator controls.

hth

D'Arcy
 
Hey Rexxx,

I've posted a sample file showing a possible solution for your problem (or at the least a pointer to the right direction)

Just go to

and join our forum workspace. Then go to the file download area (select the html version, NOT the windows version), and get the ValidatorEx files from the msmaxx folder.

D'Arcy
 
Thanks for the info, I'll check it out.
 
jfrost10

I signed up and went to the site but cannot find the msmaxx folder (I see user folders but search found msmaxx). The only down load area I found was the .Net downloads and I don't see Windows or HTML there. ? Can you provide a more clear way to get there ? Thanks again.
 
hey Rexxx,

when you go to the link, on the left there's a link that says
"Apply to Join This Workspace"

Just click that, go through the steps, and as soon as i get the email from them and auth you, you'll be able to get to the download area

Sorry about that
:)

D
 
Thanks. I think I got it this time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top