• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 13. Creating Forms > Testing Your Forms

Testing Your Forms

You can send a form to an e-mail address even if you don't have a CGI script running on your server. This should only be used to test your forms.

In the myform.htm document, select the form below the text “Enter our drawing for a free adventure trip” by clicking on the red lines. In the Action field of the form on the property inspector, type mailto: followed by your e-mail address.

You should remember to include the colon and no spaces. It should appear as mailto:info@mysite.com with your e-mail address replacing info@mysite.com. This is the same way you inserted manual e-mail links in Lesson 3.

Choose POST from the Method drop-down menu.

You should then also set the encode type to plain text; otherwise, the text sent will be encoded into an almost unreadable form.

Switch to split Code and Design view by choosing View > Code and Design or clicking the Show Code View icon on the document window tool bar.

Look for the form tag. You can find it easily, because all the form code from the <form> to </form> tags in the code is highlighted because you selected the form. Scroll to the top of the highlighted area and deselect the code by placing the insertion point inside the <form> tag.

Type enctype=“text/plain” within the <form> tag.

The code should look like this:

<form method="post" action="mailto:info@mysite.com" enctype="text/plain">

The enctype defines how the data in the form is encoded. The text/plain value formats the information with each form element on a separate line. Using this value will make it easier to read the results in an e-mail. If you don't define an enctype value, browsers will use a default value that formats the data. Because the default is the one that should be used in most circumstances, you will usually not need to specify an enctype. This example is an exception, because you are sending the data in an e-mail to test the form.

To add a subject line, change the action like this:

action="mailto:info@mysite.com?Subject=Title for Subject goes here"

You can uses spaces in the subject, but do not use any other special characters such as quote marks, apostrophes, periods, or slashes because they will interfere with the HTML code.

This form action might not work in all browsers. Use it only for testing. You should always use a CGI script to send your forms. If your computer is not configured to send e-mail, you will not be able to test this form in this manner.

Save the file and test it in the browser.

You can close this file.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint