Mr Chunder
May 16th, 2001, 02:26 PM
I was wondering about the best method to write a form in ASP and make it a bit of a corporate standard.
There are all sorts of methods of writing an ASP form but basically you want to do the following:
1. Startup and read values from a database
2. Display values on the form
3. User can edit them and hit either cancel or submit
4. On submit, validate the data on the form
5. If invalid, return the user to the form pointing out the errors
6. Goto 3.
A solution that I reckon is the best is to:
1. Use only one ASP page for the whole process
2. The single page is structured as follows:
if this has just been submitted (we are using one page for everything)
Validate data on form
Check for dodgy characters that break SQL or display such as ', > < etc.
if dodgy data then
Return page to user with all previous user input
else
save data to database
else
retrieve data from database (if exists)
display to user
end if
Use post method to the same ASP page
I reckon this is the best standard approach since this has the following advantage:
1. All activity is in one place
2. All validation routines such as email addresses or check for dodgy characters would be standard and located in asp includes for reuse
What are opinions of seasoned ASP programmers ? Anyone with a better approach ?
There are all sorts of methods of writing an ASP form but basically you want to do the following:
1. Startup and read values from a database
2. Display values on the form
3. User can edit them and hit either cancel or submit
4. On submit, validate the data on the form
5. If invalid, return the user to the form pointing out the errors
6. Goto 3.
A solution that I reckon is the best is to:
1. Use only one ASP page for the whole process
2. The single page is structured as follows:
if this has just been submitted (we are using one page for everything)
Validate data on form
Check for dodgy characters that break SQL or display such as ', > < etc.
if dodgy data then
Return page to user with all previous user input
else
save data to database
else
retrieve data from database (if exists)
display to user
end if
Use post method to the same ASP page
I reckon this is the best standard approach since this has the following advantage:
1. All activity is in one place
2. All validation routines such as email addresses or check for dodgy characters would be standard and located in asp includes for reuse
What are opinions of seasoned ASP programmers ? Anyone with a better approach ?