![]() |
This documentation was adapted from the Web Form with Transform 3.0: the Users' Guide
This is a continuation of the Using Transform to Process Web Forms tutorial and covers how to cause web form responses to be appended to a single data file. It is based on the same sample form used previously.
The first step is to create the required directory where the data file must reside. This new directory will reside in your home directory, not your www or Forms directory.
The template below is a continuation of the one you previously began. New additions to the sample template file below are shown in RED.
|
# begin template # this *email-response* section modifies some E-mail fields to make them # required by adding a req- to the field name # notice that only a single iteration of a specific field must be made required # for it to be required in every instance of the form *email-response* To: type your E-mail address here From: [req-email] Subject: Question from [req-name] [name] submitted this Ice Cream survey Submitted information: E-mail address: [email] Phone: [req-phone] Address: [address] [name]'s favorite ice cream is [favorite] [other]. [name] has a [entry]. [name] discovered his/her favorite place to each ice cream from one or more of the following: *[cindy] *[talk] *[man] *[droveby] *[kid]—identify: [whatkid] Additional comments: [suggestion] # Now let's add a section which describes a successful form submission # Note the *success-response* section header # Since this response is being returned to the user's www browser it # must be a correct html document *success-response* <HTML> <HEAD> <TITLE>The Ice Cream Survey</TITLE> </HEAD> <BODY> <P>Thank you, [name], for your submission</P> <P>I have recorded the following survey information:</P> <P>[name] submitted this Ice Cream survey</P> <P>Submitted information:<BR> E-mail address: [email]<BR> Phone: [phone]<BR> Address: [address]</P> <P>[name]'s favorite ice cream is [favorite], [other].</P> <P>[name] has a [entry].</P> <P>[name] discovered his/her favorite place to each ice cream from one or more of the following:<BR> *[cindy]<BR> *[talk]<BR> *[man]<BR> *[droveby]<BR> *[kid]—identify: [whatkid]</P> <P>Additional comments:</P> <P>[suggestion]</P> </BODY> </HTML> # Now let's add an error-response section # Again, this must be in the form of an html document because it is being # returned to the user's browser. # Remember, this section is displayed to the reader when required # fields, flagged with req-, are not completed by the reader. *error-response* <HTML> <HEAD> <TITLE>Error in Form Submission</TITLE> </HEAD> <BODY> <P>Sorry, [name], you have attempted to submit an incomplete form.</P> <P>Make sure you have completed the following fields:<BR> Your E-mail address: [email]<BR> Your phone number: [phone]<BR> Your name: [name]</P> <P>Use your browser's back button to return to the form and complete the necessary fields.</P> </BODY> </HTML> # the *append-response* section will append the results of this ice cream survey # to a file named ice_cream_survey.dat # the data file will be created with the first submission if it does not # already exist *append-response* !append-file-name = "~your userid here/form_data/ice_cream_survey.dat" Name: [name] E-mail: [email] Phone: [phone] Address: [address] Favorite Ice Cream Flavor: [favorite] If Other, identify: [other] Type of Form Entry: [entry] How did you discover place: *Cindy? [cindy] *Word of Mouth? [talk] *Ice Cream Man? [man] *Drove by? [droveby] *Neighborhood Kid? [kid] which one? [whatkid] Comments? [suggestion] # end template file |
Return to Using Transform to Process Web Forms