Handling large form submissions

M

Michael

Does anyone have any ideas about how I can go about this faster.

I have a large form that is being submitted, and from that a new row in a
database will be created. I'm working on the page that will error check
whatever they send before it gets put in the database. I just want to do
pretty basic things, make sure numbers are really numbers, text length
doesn't go past the length specified in the database, etc.

My problem is, I'm stuck going through about 70 Request.Form("myvar") and
applying the checks. Makes for lots of coding i'd rather not waste my time
on.

Does anyone have any ideas for making this process faster?

Thanks
--Michael
 
B

Bob Barrows

Michael said:
Does anyone have any ideas about how I can go about this faster.

I have a large form that is being submitted, and from that a new row
in a database will be created. I'm working on the page that will
error check whatever they send before it gets put in the database. I
just want to do pretty basic things, make sure numbers are really
numbers, text length doesn't go past the length specified in the
database, etc.

My problem is, I'm stuck going through about 70 Request.Form("myvar")
and applying the checks. Makes for lots of coding i'd rather not
waste my time on.

Does anyone have any ideas for making this process faster?

Thanks
--Michael

Break the form up into smaller bits? You'll still need to write the code to
validate all 70, but there will probably be less impact on the user.
Consider this: the user inputs data into 65 of the input fields and
something happens before the form is submitted - the computer/browser
crashes, a power failure, etc. So now you have a frustrated user who has to
enter all 65 pieces of data again! Not cool.

Better would be to put related sections of the data into their own forms.
When the user hits continue,. the data from the smaller form gets saved
before going on to the next form. That way, if the process gets interrupted,
the user can start off where he left off, only having to re-enter a smaller
amount of data.

Bob Barrows
 
W

William Morris

Make the names of your form fields significant. The method I use is as
follows:

fld t Firstname
fld t Lastname
fld n Age
fld d Birthdate

fld = this is a field I want to work with
t = text field
n = numeric field
d = date field

On form submit, it's a simple matter, then, to write a javascript loop that
looks for the "fld" and decides how to validate based on {t|n|d}. Error
messages are collected, concantenated together, then displayed at the end.
If there are no messages, the function returns true and the form submits.

This same method can be used server side to write insert and update sql
statements. Changes to forms require no rewrite of any of the processing
code as long as the new fields follow the convention.

- Wm
 
J

John Beschler

Michael, I like that idea. I've used the same idea for
forms where I have multiple checkboxs, etc. but never
thought about doing that for validation.

Thanks for the tip.
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top