Re: Long forms

by =?iso-8859-1?Q?St=E9phane?= Bergeron <stephberg(at)videotron.ca>

 Date:  Thu, 30 Mar 2000 17:05:46 -0500
 To:  hwg-techniques(at)hwg.org
 Cc:  Rick Koch <rrcominc(at)cris.com>
 In-Reply-To:  cris
  todo: View Thread, Original
At 07:32 AM 30/03/00 -0700, you wrote:
>I want to have a short form that can be submitted as is, OR can
>optionally send the visitor to a second page asking for substantially
>more info.  Submitting that second page needs to include the first
>page's info as well. Is this making sense?!?!

Hi Rick,

I would do this using hidden form fields that would contain the previous=20
page's data and like others pointed out, this would work with many server=20
side scripting languages including Perl, PHP and of course ASP.  PHP and=20
ASP have the advantage of being mingled right into the HTML which makes for=
=20
more readable code IMO.  The second and any subsequent forms would look=20
something like the following (for ASP):

<form action=3D"processform.asp" method=3D"post">

<input type=3D"hidden" name=3D"email" value=3D"<%=3D request.form("email")=
 %>">
<input type=3D"hidden" name=3D"firstname" value=3D"<%=3D=
 request.form("firstname") %>">

...etc

</form>

You should probably do some data validation with JavaScript before the form=
=20
gets submitted and also do it on the server in case the user doesn't have=20
JavaScript or has it turned off.  In the above example I insert the value=20
of the previous form's fields directly in the hidden input tags' value=20
attributes but, in a real life application, I'd make sure the user entered=
=20
proper data first.

HTH!

St=E9phane Bergeron

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA