Form field error messages

S

Shabam

I know that dotnet allows for form field validation. However I'm looking to
customize the error message display and am wondering if it's possible to do
what I need.

Example:

Suppose in a form there is a "Name" field (required). The user leaves it
blank and submits the form. I need to reload the page with the "Name" in
red so the user can see which field(s) have errors in them.

Second, at the top of the page I need a table displaying a descriptive error
message. That table would be customized of course.

I've been told that dotnet does the error output dynamically via client end
script, then server end script if user has turned off javascript. I was
also told that dotnet has limitations in terms of customizing it the way
I've described.

Is this true? If not how does one go about customizing it like I've stated?
 
H

Hermit Dave

you have validation controls that you can use in asp.net.
if you have vs.net... you will find them in the toolbox where you can drop
them on to aspx in the designer.

RequiredFieldValidator does what it says... if you assign a control to it...
the user has to populate the control.. like a text box and only then it will
allow form submission.
you have other validation controls like RangeValidation Regular Expressions
Validator etc. you can specify what you want...

you have validation summary control that automatically does a list of error
messages from validation controls.

you can customise error messages and even write your own validations. have a
look at the links

http://samples.gotdotnet.com/quickstart/aspplus/doc/webvalidation.aspx

http://www.codeproject.com/useritems/ValidatorCtrl_by_VIVEK.asp

http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=46

http://www.4guysfromrolla.com/webtech/090200-1.shtml

http://www.15seconds.com/issue/030211.htm

HTH
--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 
S

Shabam

Hermit Dave said:
you have validation controls that you can use in asp.net.
if you have vs.net... you will find them in the toolbox where you can drop
them on to aspx in the designer.

RequiredFieldValidator does what it says... if you assign a control to it...
the user has to populate the control.. like a text box and only then it will
allow form submission.
you have other validation controls like RangeValidation Regular Expressions
Validator etc. you can specify what you want...

you have validation summary control that automatically does a list of error
messages from validation controls.

you can customise error messages and even write your own validations. have a
look at the links

Thanks for the input. I understand there are server validation controls in
vs.net. However I need to customize them to my needs. As I understand it,
error messages appear after the control. I would like to just change the
font color of the heading to red. Also, at the top of the page, I need to
print out the exact errors, but surround the messages with my custom table
and graphic. How do I go about doing such? Thanks.
 
H

Hermit Dave

The validation controls have two properties.. one is Error Message and the
other one is Text
If you populate both and have a Summary Control then...
the Text is display next on the validation control
the Error message is displayed in the summary control.

if you want the error message in Red.. then just set the Validation /
Summary Control's CssClass to the right style.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top