Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Validating user input in web forms

Author  Topic 

Bex
Aged Yak Warrior

580 Posts

Posted - 2005-09-09 : 05:10:17
Morning

I am a database programmer and have never delved into ASP.NET, C#, etc but unfortunately, we are short on resources, hence I have been given the task to validate user input in a web forms page. We have four text boxes:
-AccountName
-AccountNumber
-InvoiceNumber
-Date *

Date is always required, and at least one of AccountName, AccountNumber or InvoiceNumber. From what I read, it appears that RequiredFieldValidator only validates one control. Therefore, how can I validate AccountNumber, AccountName and InvoiceNumber to ensure that at least one value is provided?

Thanks in advance



Hearty head pats

Kristen
Test

22859 Posts

Posted - 2005-09-09 : 06:47:04
JavaScript in the OnSubmit event handler?

Dunno about DotNet, but that's how I'd do it in ASP

Kristen
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-09-09 : 06:58:28
put a Javascript function on your button that submits data:
onsubmit='yourValidatorFunction()'
that checks the reguired fields and if not correct return false else return true.

In .net it's the same thing if you want a check on the client side (without a trip back to the server).
if you dowant a trip back to the server do it in your .net code... OnLoad function

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Bex
Aged Yak Warrior

580 Posts

Posted - 2005-09-09 : 08:13:39
Thank you so much! Thats exactly the info that I wanted! Have good weekends!

Hearty head pats
Go to Top of Page
   

- Advertisement -