By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,490 Members | 3,266 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,490 IT Pros & Developers. It's quick & easy.

Required Field?

P: n/a
Hi,

Could someone give me a quick review of how to use the required field
Validator? I'm completely at a loss, and MSDN does not help one bit. =/
Basically all I want done is to make sure that the user enters some
text into a field called "txbName" and when they click on the submit
button, if they have not entered anything into the field, a Required
Field Validator will say "Invalid Name".

Thanks,
Kivak Wolf

Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Kivak Wolf wrote:
Hi,

Could someone give me a quick review of how to use the required field
Validator? I'm completely at a loss, and MSDN does not help one bit. =/
Basically all I want done is to make sure that the user enters some
text into a field called "txbName" and when they click on the submit
button, if they have not entered anything into the field, a Required
Field Validator will say "Invalid Name".

Thanks,
Kivak Wolf


- Toss the validator on the page.
- Assign it's control to validate to your txtBox
- Give the validator an error messsage.
- I like to put a Validation Summary control on the page to centralize
the messages.
- compile, run.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #2

P: n/a
as simple as this:
<asp:requiredfieldvalidator id="ReqValtxbName" runat="server"
EnableClientScript="True" Display="Dynamic" ControlToValidate="txbName"
ErrorMessage="Invalid Name"></asp:requiredfieldvalidator>
"Kivak Wolf" <Li**********@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Hi,

Could someone give me a quick review of how to use the required field
Validator? I'm completely at a loss, and MSDN does not help one bit. =/
Basically all I want done is to make sure that the user enters some
text into a field called "txbName" and when they click on the submit
button, if they have not entered anything into the field, a Required
Field Validator will say "Invalid Name".

Thanks,
Kivak Wolf

Nov 19 '05 #3

P: n/a
While I agree with the other answers, there is one more step. Always setup
server side validation because you cannot assume all browsers visiting your
site will run the client-side javascript supplied by Microsoft. In fact,
only IE and IE/Mac support their javascript in ASP.NET 1.x.

I've put together an article to educate users on validation. It discusses
setting up server side validation with examples and issues with client-side
validation. www.aspalliance.com/699.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Kivak Wolf" <Li**********@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Hi,

Could someone give me a quick review of how to use the required field
Validator? I'm completely at a loss, and MSDN does not help one bit. =/
Basically all I want done is to make sure that the user enters some
text into a field called "txbName" and when they click on the submit
button, if they have not entered anything into the field, a Required
Field Validator will say "Invalid Name".

Thanks,
Kivak Wolf

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.