Using Web Forms FAQ


Q: What is a web form?
A: A Web form is a way for someone browsing your Webpage to send information to the Web server. There is a small program (script) running on the server that collects the information. The script provided by Web Services Unit takes that information and sends it to a specified address in the form of an e-mail.

Q: How do I include a web form on my page?
A: To put a form on your page, you need to edit the HTML source code. This is the HTML code for a minimal form that can be handled by the script provided by Web Services:

<form action="http://www.sjsu.edu/cgi-bin/mail_form.pl" method="post">
<input type="hidden" name="TO" value="your e-mail address" />
<input type="hidden" name="SUBJECT" value="your e-mail subject" />
<label for="lname">Last Name:</label>
<input type="text" id="lname" name="LNAME" /><br />
<label for="fname">First Name: </label>
<input type="text" id="fname" name="FNAME" /><br />
<label for="email">E-mail Address: </label>
<input name="FROM" id="email" type="text" size="60" /><br />
<label for="comments">Comments:</label><br />
<textarea name="COMMENTS" id="comments" cols="50" rows="4"></textarea><br />
<input name="Submit" value="Submit form" type="submit" />
<input name="Reset" value="Reset form" type="reset" />
</form>

Items in italics should be replaced with your own information.

Note: Do not change the name of any of the required fields. They must be exactly as shown above, including being all upper case.

Q: What is a required field?
A: A required field is one that must have a value entered into it by the user in order for the form to be accepted. If a required field is left blank, the person who submitted it will see a message indicating which field(s) need to have values. The following fields are always required:

  • FROM (the e-mail address of the person submitting the form)
  • TO or STO (the e-mail address or code of the person the data will be sent to)
  • COMMENT (comments entered by the person submitting the form)
  • LNAME (the last name of the person submitting the form)
  • FNAME (the first name of the person submitting the form)

See the previous question for how to add these required fields to your form.

Q: Can I add other fields?
A: Yes, you can add as many additional fields as you want. See the field types for more details.

Q:What field types are available?
A: The following are the types of field you may use, including an example and the HTML code that created it.

Text
One line of text

<input name="example" type="text" />
Textarea
Several lines of text that can scroll vertically

<textarea name="COMMENTS" rows="5" cols="40"></textarea>
Note: There is currently a limit of 1500 characters for a textarea.
Select
Choose one item from a drop-down list 

<select name="example">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
</select>
Select multiple
Choose one or more items from a drop-down list (use shift-click or ctrl-click to select multiple items)

<select name="example" size="2" multiple="multiple">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
</select>
Radio button
Choose one of several options



<label for="rb1">Radio A</label>
<input name="example" type="radio" value="radiobutton_A" id="rb1" />
<br /><label for="rb2">Radio B</label>
<input name="example" type="radio" value="radiobutton_B" id="rb2" />
<br /><label for="rb3">Radio C</label>
<input name="example" type="radio" value="radiobutton_C" id="rb3" />

Note: all radio buttons in the same group must have the same name. The value determines which one was selected.
Checkbox
Choose any number from a list of options



<label for="cb1">Checkbox A</label><input name="checkbox1" type="checkbox" id="cb1" value="A" /><br />
<label for="cb2">Checkbox B</label><input name="checkbox2" type="checkbox" id="cb2" value="B" /><br />
<label for="cb3">Checkbox C</label><input name="checkbox3" type="checkbox" id="cb3" value="C" />
One line of text, not displayed on screen

<input name="example" type="password" />

Q: How do I make a custom field required?
A: To make a text field required, give it a name that ends with '*'.

Q: What happens after the form is submitted?
A: A program on the Web server gathers the form data and composes an e-mail which is sent to the specified addresses.
The person who submitted the form sees a confirmation page. The confirmation page can be customized.

Q: Does the person who submitted the form receive an e-mail?
A: By default, the person who submitted the form will only see a confirmation Web page. If you would like the submitter to also receive a copy of the e-mail, you can make a request to the Web Services Unit to add your form to the list of forms with that capabilityOpen an iSupport ticket with detailed information.

Q: Can I "reply" to the e-mail?
A: By default, you cannot reply to the e-mail. In order to guarantee that e-mail will not be "dropped" by the mail server due to an invalid FROM address, the form handler on the Web server substitutes "do-not-reply@sjsu.edu" as the FROM and REPLY-TO address. If you would like the ability to reply to the e-mail, you can add this line to the form on your Web page:
<input type="hidden" name="use_senders_return_address" value="true" />
Note: If you add this line to your form, it is possible that some e-mails (those with invalid FROM addresses) will be lost.

Q: How do I customize the confirmation page?
A: Use the special fields CSTART, CEND, and CCONFIRM.

  • CSTART can be used to specify an HTML file with content to be displayed at the top of the confirmation page.
  • CEND can be used to specify an HTML file with content to be displayed at the end of the confirmation page.
  • CCONFIRM can be used to specify an HTML file that will replace the body of the confirmation page.

Note: CSTART and CEND can be used separately or together. CCONFIRM can only be used by itself.

Q: How do I get the form data?
A: The data will be sent to you in an e-mail.

Q: Can I have the form data sent to more than one person?
A: Yes. Open an iSupport ticket with detailed information.  Submit a request to the Web Services Unit that includes the e-mail address(es) you want the data sent to. We will provide you with a hash code that can be used in the "STO" (Secure TO) field instead of TO field. This has the additional benefit of hiding the e-mail address from "spammers".

Q: Can my e-mail address be hidden?
A: Yes, use the STO field. Open an iSupport ticket with detailed information. Submit a request to Web Services with the e-mail address you want to hide. We will provide you with a code that can be used in the STO field to replace your actual address in the TO field.

Q: How can I make my forms more accessible?
A: In order to make forms more accessible to people using assistive technology, such as screen readers, you should associate each field with its label. To do this, use the "for" attribute of the label tag to match the "id" attribute of the input tag.
For example:
<label for="lname">Last Name</label><input type="text" name="last_name" id="lname" />