|
Basic HTML | Site management | Assets | Library of Page Elements| Find and Replace | Templates | Style Sheets | Forms | Imagemaps | Mouseovers | Flash buttons & text | Frames | Tables: Formatting & Sorting | Preview Browsers | Font Lists | Colors | Automating Tasks | Pasting in a Script |
Forms |
|
You can use Dreamweaver to set up forms which to take and process input. In order for forms to work, they must call on a computer program, called a script, to process that input. Lehigh has a few scripts set up on the main server. If you want to use other scripts, you will need to run them from another site or look into using space on cgi.cc.lehigh.edu (see the Advanced Web Authoring Seminar for more information). Most people will be using the Lehigh form-processing script (pquery), unless they are using form-processing scripts from other servers. So we will be using the Lehigh form processing script, which simply takes input from the form and emails it to a specific address, as our example. For more documentation on using the Lehigh form processing script, see: http://www.lehigh.edu/computing/web/form_handler.html First, you have to set up the form: choose Form from the Insert menu, then select Form: The form will appear as a box outlined in dotted red lines:
Then you must set the properties of the form. Clicking inside on the
red dotted line around the form makes the Properties panel display the
form properties: The Method should be Post; the Action is the URL (web address) of the
form processing script, in this case: You can put a name in the 'Form Name' field, but our forms processor doesn't use it. Inside the form, you will need to put fields. To insert a field, from
the Insert menu, choose Form, then the type of field you want: Or, change the Insert panel from Common to Forms and choose the form
objects from there. After a field is created, you have to set its properties, including name and, if necessary, value. Note: you can also use the Insert Panel to insert form objects. Go to
the top of the Insert Panel, where the label is usually Common: and click on the down triangle to see the list of Insert menu types.
Choose Forms. The Insert panel will change to show forms options instead
of common options. Setting up a form to use the form processing scriptLehigh's form processing script, pquery, requires a number of fields to be present in every form: FORMNAME, RECIPIENT, and SENDER. To insert the FORMNAME field (which should generally be a hidden field,
and isn't the same as the 'Name' property of the form): Click inside the
form. Choose Form from the Insert menu, then choose 'Hidden Field'.
Click on the yellow tab that appears and change the properties so that
the field name (under HiddenField) becomes FORMNAME and the value is the
name you want your field to have (this will be the header of the e-mail
that is sent with the contents: To insert the RECIPIENT field (which should generally be a hidden field):
Click inside the form. Choose Form from the Insert menu, then choose
'Hidden Field'. Click on the yellow tab that appears and change the properties
so that the field name (under HiddenField) becomes RECIPIENT, and the
value is the e-mail address that you want the form contents sent to: You will need a SENDER (the e-mail address of the person filling out
the form) field, but you will want that filled in by the user. So you
will have to add some information in the field, such as 'Your E-mail address:'
and follow it with a visible field. You can type inside a form (type inside
the red lines) as you would normally. Then to insert the SENDER field,
click where you want the field, and choose Form from the Insert
menu, then select 'Text field'. You will want to fill in the form's name
as SENDER. You can set the width to be the width of the usual Lehigh e-mail
address (17 characters) and give an initial value that looks like a complete
e-mail address to encourage people to fill in their complete e-mail address. Now you just add fields and text to complete your form. Note: for the pquery script, field names must not have spaces in them; field values can have spaces in them. Required FieldsThe Pquery Script allows you to make fields required by inserting a hidden field with the name 'Fieldname-REQUIRED' before the field that you want required, where the Fieldname matches the name of the field to be required.
Example: |
| Next Page: |