Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

long forms problem

Status
Not open for further replies.

omerdurdu

Programmer
Jul 21, 2001
72
TR
I have a form has like 1000 lines. Is it possible restrict that 100 lines (with input boxes)per page and at the end of the form, I mean at 10th page put a insert button and instert data into database. Do you have any idea how to do that.
 
i know of 3 approaches

1. only the last page is an action page, meaning that the data gets saved to the database only at the end, but this means page 2 has to send form fields from both page 2 and page 1 (usually as hidden fields), page 3 has to send 1-3, and so on (this is the method that static html pages use)

2. each page is an action page, and saves the form fields it has received from the previous page into the database, so if you are sitting on page 6 then you have already saved pages 1 through 5 in the database

3. each page saves its form fields in session variables, and page 10 saves them all into the database

the main problem with multi-page forms is that the user will often go back to a previous page

if the user goes back, one of the worst things you can do is lose the data that was entered and display a blank form -- i'm sure we've all seen how that works

so what you have to do in method 1 is pass all the hidden form fields backwards too

so, when you start to code a page, you realize you actually have to set up to receive hidden form fields either from all the pages that preceded it, or all the pages that follow it, and in either case, you have to re-populate that page's form fields with the correct hidden fields

with method 2, each page saves its data into the database, so it basically can stand on its own, and if page 10's form submission is successful, the form is "complete" -- this means there has to be a garbage collection program that goes through and removes incomplete or abandoned form entries (say on sunday at 2 a.m. or something)

method 3 is basically the same as method 2 except if the user is called away from her desk for few minutes, she could come back and find her session died while she was filling out page 10, and has to re-enter everything -- yikes

i prefer method 2, because it is the most user-friendly, and it also makes for simpler coding, in my opinion -- but your mileage may vary

rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top