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

validationsummary question

P: n/a
I am successfully using the client side validation controls, but there
are a couple aspects of their behavior that I wish to modify. I cannot
see how to accomplish this through the properties, but I thought I
would ask here for advice.

- ValidationSummary

When there are validation errors on the page, the summary control
displays its HeaderText at the top of my form. However, it lists each
validation problem. Additionally each error is shown next to the
problem control. This is all fine except for the summary control
listing each validation problem. How can I make it so that the summary
control only displays its HeaderText and suppresses the errors for each
control?

- Multiple Validators For a Control

I have a required field and a regular expression validator on one
control. The controls are created on the form in the order of required
validator first and reg exp validator second. When the control has
some data, but fails the regular expression, the error message is
shifted to the right of the required field message (which remains
hidden). Looking at the HTML I see the validators use a
visibility=hidden style instead of a display=none style. Is there a
way to make the validators use the latter attribute? This would solve
the alignment issue.

Thanks,
John

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


P: n/a
The ValidationSummary is controlled by what you specify for the ErrorMessage
property for each of the individual Validation controls. If you leave this
empty then the ValidationSummary won't show an entry for that validation
control. If you were previously using the ErrorMessage property to indicate
the message next to the control you were validating, use the Text propery
instead (or just put content inside the validation control begin & end tags).

-Brock
DevelopMentor
http://staff.develop.com/ballen
I am successfully using the client side validation controls, but there
are a couple aspects of their behavior that I wish to modify. I
cannot see how to accomplish this through the properties, but I
thought I would ask here for advice.

- ValidationSummary

When there are validation errors on the page, the summary control
displays its HeaderText at the top of my form. However, it lists each
validation problem. Additionally each error is shown next to the
problem control. This is all fine except for the summary control
listing each validation problem. How can I make it so that the
summary control only displays its HeaderText and suppresses the errors
for each control?

- Multiple Validators For a Control

I have a required field and a regular expression validator on one
control. The controls are created on the form in the order of
required validator first and reg exp validator second. When the
control has some data, but fails the regular expression, the error
message is shifted to the right of the required field message (which
remains hidden). Looking at the HTML I see the validators use a
visibility=hidden style instead of a display=none style. Is there a
way to make the validators use the latter attribute? This would solve
the alignment issue.

Thanks,
John


Nov 19 '05 #2

P: n/a
Oops, I dind't answer the second half of your question. You want to use the
Display="Dynamic" (instead of Display="Static") on the validation controls.
This will render visibility:hidden instead of display:none.

-Brock
DevelopMentor
http://staff.develop.com/ballen

- Multiple Validators For a Control

I have a required field and a regular expression validator on one
control. The controls are created on the form in the order of
required validator first and reg exp validator second. When the
control has some data, but fails the regular expression, the error
message is shifted to the right of the required field message (which
remains hidden). Looking at the HTML I see the validators use a
visibility=hidden style instead of a display=none style. Is there a
way to make the validators use the latter attribute? This would solve
the alignment issue.

Thanks,
John


Nov 19 '05 #3

P: n/a
Great, thanks for the tips. Another question if you don't mind.

I notice the validation puts the following code in the onsubmit event
for the form...

if (!ValidatorOnSubmit()) return false;

However, on another site I have it only puts...

ValidatorOnSubmit();

On the former, I cannot get the form to submit and the latter works
fine. Also the latter is what I see on other asp.net sites. What
would cause the validation framework to put the former code in?

Thanks,
John

Nov 19 '05 #4

P: n/a
Hi John,

The ValidationSummary is not designed to only show the HeaderText. You have
to add a minimum of something like " " to the ErrorMessage property and
set its DisplayMode to SingleParagraph. You will always get an extra line
containing those spaces.

I wrote a replacement to Microsoft's validators that greatly increases the
featureset of the validation system. "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx) basically addresses most complaints
users have with Microsoft's validators, avoiding the custom code and hacks
users have faced. Some examples of how it works better for you:
- The ValidationSummary's DisplayMode has a setting of "None" so that you
never show anything for error messages in the summary.
- The RegexValidator has a property, IgnoreBlankText, that when false, will
report an error if the text is blank. That avoids adding a
RequiredFieldValidator.
- When you want to combine validators together under one error message, use
my MultiConditionValidator.
- All of my 22 validators support client-side validation on IE, IE/Mac,
Mozilla, Netscape 7, FireFox, Opera 7, and Safari. Microsoft's only works on
DHTML browsers (IE and IE/Mac).

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

<jo************@inginix.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
I am successfully using the client side validation controls, but there
are a couple aspects of their behavior that I wish to modify. I cannot
see how to accomplish this through the properties, but I thought I
would ask here for advice.

- ValidationSummary

When there are validation errors on the page, the summary control
displays its HeaderText at the top of my form. However, it lists each
validation problem. Additionally each error is shown next to the
problem control. This is all fine except for the summary control
listing each validation problem. How can I make it so that the summary
control only displays its HeaderText and suppresses the errors for each
control?

- Multiple Validators For a Control

I have a required field and a regular expression validator on one
control. The controls are created on the form in the order of required
validator first and reg exp validator second. When the control has
some data, but fails the regular expression, the error message is
shifted to the right of the required field message (which remains
hidden). Looking at the HTML I see the validators use a
visibility=hidden style instead of a display=none style. Is there a
way to make the validators use the latter attribute? This would solve
the alignment issue.

Thanks,
John

Nov 19 '05 #5

P: n/a
Hmm, don't know iff the top of my head withouyt looking at all of the code.
Perhaps it's a diff between ASP.NET 1.0 and 1.1?

-Brock
DevelopMentor
http://staff.develop.com/ballen
Great, thanks for the tips. Another question if you don't mind.

I notice the validation puts the following code in the onsubmit event
for the form...

if (!ValidatorOnSubmit()) return false;

However, on another site I have it only puts...

ValidatorOnSubmit();

On the former, I cannot get the form to submit and the latter works
fine. Also the latter is what I see on other asp.net sites. What
would cause the validation framework to put the former code in?

Thanks,
John


Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.