Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: RE: Large form insert


Message #1 by Dwain.Gleason@m... on Tue, 5 Mar 2002 18:37:08 -0600
I've done a couple of these types of forms, here's how I've done them.



I actually put the entire application into one ASP file. That way I can

rely on server-side scripting and not have to expose any form contents

as querystring. The entire form is self-submitting. All form variables

are validated and then passed to the next form, or the form is

redisplayed with error messages and highlights. Here's a little pseudo

code:



If HTTP Method is "GET" Then

      'This is the first display of the form

      bolValidated = True

      intForm = 1

      Call subFormDisplay

Else

      'The form has been submitted

      bolValidated = False

      Call subFormProcess

End If



Sub subFormProcess

      'Find out what form you're validating

      intForm = Request.Form("intForm")

      Select Case intForm

            Case x...

                  ...Perform validation routines on form fields

                  If all fields validate THEN 

                        bolValidated = True 

                        intForm = intForm + 1

                        call subDisplayForm

                  ELSE 

                        bolValidated = False

                        call subDisplayForm

                  End If

            ...iterate cases

            Case Else ' final step - email or post form results to db

      End Select

End Sub



Sub subDisplayForm

      Select Case intForm

            Case x...

                  'Get all passed fields from the last form, keeping

their names

                        For Each Field in Request.Form

                              Response.Write("<input type='hidden'

name='" & field & 

                              "' value='" & Request.Form(field) & "'>" &

vbCrLf)

                        Next

                  If Not bolValidated Then

                        ...display error messages, include highlights,

etc.

                  Else

                        ...display as normal

                  End If

            ...iterate cases for form displays

      End Select

End Sub



It it probably more complicated than cookies or server variables, but it

was a neat exercise that I learned a lot from doing. It's something to

consider.





Quoted Message: ----------------------------------------------------

Subject: RE: Large form insert

From: Sam Clohesy <sam@e...>

Date: Tue, 5 Mar 2002 18:14:33 -0000

X-Message-Number: 10





Hi all, bit of advice needed.

I have a HUGE insert form which I have split into three sections, what

is

the best way to 



a) Keep performance up (Using SQL 7 and stored proc)

b) Carry values from insert page1 to insert page2 etc



A few ideas I have had (please tell me if I am being an idiot)



1) Carry stuff in session variables

2) Cookies

3) Write to XML/ text file?

4) Transaction SQL statement?



Any suggestions much appreaciated

Thanks

Sam





Message #2 by Sam Clohesy <sam@e...> on Tue, 5 Mar 2002 18:14:33 -0000

Hi all, bit of advice needed.

I have a HUGE insert form which I have split into three sections, what is

the best way to 



a) Keep performance up (Using SQL 7 and stored proc)

b) Carry values from insert page1 to insert page2 etc



A few ideas I have had (please tell me if I am being an idiot)



1) Carry stuff in session variables

2) Cookies

3) Write to XML/ text file?

4) Transaction SQL statement?



Any suggestions much appreaciated

Thanks

Sam


  Return to Index