Groups | Blog | Home
all groups > asp.net webcontrols > november 2007 >

asp.net webcontrols : required field validators and not validating until submit button clicked


TS
11/9/2007 2:21:02 PM
i read this in a book: "...There is also logic in place to avoid enforcing
RequiredFieldValidator controls until the page has been submitted (or has
attempted to be submitted) at least once. This allows users to fill in
fields in any order without being warned that a field is required..."

is this true and if so how does the framework know to do this?

i wonder because in our web app, if you say have a value in a textbox with a
RFV and then blank it out and tab out, an alert popup shows up (validator is
set to dynamic display) so it validates immediately instead of waiting till
the submit button runs (which calls Page_ClientValidate)

thanks

Scott M.
11/9/2007 5:07:31 PM
Fields can be filled in in any order, but if you go to a field with an RFV
and then leave it without typing anything, you'll get warned about the
validation. This is the normal behavior. On the other hand, you can move
around the fields and fill them in as you please without triggering the RFV.
The control must receive the focus and then lose it to validate before the
page submit will trigger validation.

[quoted text, click to view]

AddThis Social Bookmark Button