adOpenStatic Logo
Ken's Blog
Contact Ken
Copyright 2000 -

Overall Structure
The overall stucture of our webpage will look like this:

UI Validation Flow Chart

We will first attempt to detect if the page has been resubmitted. If the page is not being reloaded (ie being loaded for the first time, or has been tampered with) then we will display the form. We will also load the default values for the form into local ASP variables (these might be extracted from a database, or might be blank). We will also write out the required client side javascript.

If the form is being resubmitted then we validate all the input on the serverside. If the input is all valid, then we insert it into the database (or email it, or whatever) and redirect to the next page. If the input is not valid, then we again load the form element values into local variables (eg using the Request.Form collection). We also accumulate a list of error messages. Once again we display the form, with the form element values populated by local variables, but we include the list of error message.

Our actual page structure is going to look a bit like the following, and on each subsequent page, I'll be indicating where in the page we are currently dealing with.

If isPostBack() then

   ' Perform server-side validation here

   ' If no errors after validation then

      ' Do database/etc work
      ' Redirect to next page

   ' Else load form values


   ' Load default/initial form values

End If

<!-- Load default page header/body/navigation etc -->
<!-- Load error messages -->
<!-- Load javascript validators -->
<!-- Load HTML form -->
<!-- Load default page footer etc -->



Back to Contents | Onto Client-Side validation

Back to Code Listing