473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Validate on page load

I have several required field validators on my page. Normally, when a
submit button is pressed, the validators display with a red * character
beside the corresponding field, and a validation summary displays a popup
message.

When the page is loaded I want to display all the red * characters, so the
user knows beforehand which fields are required, but I don't want to cause
the validation summary to display at this point. It should display only
when the user submits the page. How can this be done?
Nov 19 '05 #1
4 2375
"Jeremy Chapman" <me@here.com> wrote in
news:u4*************@TK2MSFTNGP15.phx.gbl:
I have several required field validators on my page. Normally, when a
submit button is pressed, the validators display with a red *
character beside the corresponding field, and a validation summary
displays a popup message.

When the page is loaded I want to display all the red * characters, so
the user knows beforehand which fields are required, but I don't want
to cause the validation summary to display at this point. It should
display only when the user submits the page. How can this be done?

Try calling Page.Validate in Page.Load, but set the visibility of your
validation summary to false.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
Nov 19 '05 #2
> When the page is loaded I want to display all the red * characters, so the
user knows beforehand which fields are required, but I don't want to cause
the validation summary to display at this point. It should display only
when the user submits the page. How can this be done?


Validators are really meant to validate a field upon submission...not to
indicate a field is required to begin with. Why not just put an astrisk in
the HTML itself to indicate that it's required?

-Darrel
Nov 19 '05 #3
I could do this, but in case we added or changed required fields I wanted to
be able to just change the validators and have it all work. If I add *
characters explicitely then I have to move them around too. I just like to
keep maintenance to a minimum as much as possible.

"darrel" <no*****@hotmail.com> wrote in message
news:uv**************@TK2MSFTNGP14.phx.gbl...
When the page is loaded I want to display all the red * characters, so
the
user knows beforehand which fields are required, but I don't want to
cause
the validation summary to display at this point. It should display only
when the user submits the page. How can this be done?


Validators are really meant to validate a field upon submission...not to
indicate a field is required to begin with. Why not just put an astrisk in
the HTML itself to indicate that it's required?

-Darrel

Nov 19 '05 #4
I realize this may be a little "above and beyond", but if your concern is
that you want to minimize the impact when changing the required fields, you
could create a custom control that includes both your "required field
indicator", and your "validator", and use that control instead of the built
in validator.

It would be quite simple to do....

"Jeremy Chapman" wrote:
I could do this, but in case we added or changed required fields I wanted to
be able to just change the validators and have it all work. If I add *
characters explicitely then I have to move them around too. I just like to
keep maintenance to a minimum as much as possible.

"darrel" <no*****@hotmail.com> wrote in message
news:uv**************@TK2MSFTNGP14.phx.gbl...
When the page is loaded I want to display all the red * characters, so
the
user knows beforehand which fields are required, but I don't want to
cause
the validation summary to display at this point. It should display only
when the user submits the page. How can this be done?


Validators are really meant to validate a field upon submission...not to
indicate a field is required to begin with. Why not just put an astrisk in
the HTML itself to indicate that it's required?

-Darrel


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: SHC | last post by:
Hi all, I have a VC++ .NET 2003 - Windows XP Pro PC. I created a Win32 console application in my VC++ .NET 2003 and copied validateDOM.cpp, books.xml and books.xsd (see the attached files below)...
5
by: Jeff Evans | last post by:
I have a custom composite control which has a validator for a textbox. The validator and textbox are declared in the class and created in the CreateChildControls() method Here is the code for the...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
5
by: Jim Heavey | last post by:
When should you use the Page.Validate() method? I thought you would use this method if you have some Server side validation (CustomControl's) you wanted to use and this would cause them to be...
2
by: Stu | last post by:
Hi, When I try and use Javascript to post page form data from one aspx page to another I get the error 'Unable to validate data. '. I am not trying to read the data using web controls I am...
8
by: tshad | last post by:
I get the following message from one of my buttons where I have CauseValidation=false. Page.IsValid cannot be called before validation has taken place In my routine I need to do: if Not...
3
by: Martin | last post by:
Hi, I am implemeting a form in asp.net. The form is quite large and the validation is reasonably complex, so I have decieded to implement my own validation rather than use any custon...
0
by: Jay Douglas | last post by:
Hello all, I'm in need of a custom validator that: 1). Runs server side code using ajax through a client validate function 2). Client validate function does not set args.IsValid until the...
26
by: webrod | last post by:
Hi, I have some php pages with a lot of HTML code. I am looking for a HTML validator tool (like TIDY). TIDY is not good enough with PHP tags (it removes a lot of php code). Do you have any...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.