BASIC JAVA MAIL FORM

This form is Java Active. The code for the basic form is contained in the table at the bottom of this page. To utilise this code simply copy and paste the code from the page or click the button below to load the example page and save the entire HTML file.

If the user's browser does not have Java capacity they need to have an alternative that they can access so that they are still able to contact you for information. The best format here is simply a list of the details you require, plus your Email address - this allows for simple Email submission. Including the subject in the Email address is ideal.

In the following section I will explain each of the changeable basics of the set-up so that you are able to edit the basic form to suit your needs.

The first part of the code is the Java Script that must be placed in the HEAD section of the code. The only part here is the allocation of the variables. Each of the variable names (VARIABLE1, VARIABLE2, VARIABLE3 and VARIABLE4) are used as required.

document.form1.VARIABLE1.value = document.VARIABLE1;

You need to have one variable for each line of input required in the form. Thus if you want 20 separate inputs, you need 20 variables. In respect to the actual variable name, indicated in the above example line as VARIABLE1, can be anything. However, whatever name you use must be used in both the places in the head as well as its position in the FORM1 section of the web page.

The opening line for the actual FORM will look similar to the following line (which is, in the code, all one line):

<FORM NAME="form1" METHOD="post" ACTION="mailto:your.address@provider.com.au?SUBJECT=Subject Name" ENCTYPE="text/plain">

The name of the form can be anything but, as with the variable names, it must be the same in all positions where the current code of form1 is used, both in the SCRIPT section and the FORM line.

METHOD refers to the fact that you wish the item to be sent.

ACTION: The section your.address@provider.com.au is the Email address you want the form data to be sent to. The SUBJECT will be of your choice to enable clear identification of the mail when received.

ENCTYPE: This deals with the method of transmission. Leave this as is unless you are really familiar with encryption formats.

The first two items of the BODY segment are optional. They will return the information about the PAGE TITLE (REFERENCE - returning contents of VALUE);

<INPUT TYPE="hidden" NAME="REFERENCE" VALUE="Page or Site Title">

The second line returns browser type. It returns Netscape and version or lists as non_Netscape if it is any other type. This can be used to determine the majority browsers of your site acccessers.

<INPUT TYPE="hidden" NAME="BROWSERTYPE" VALUE="non_Netscape">

If you remove either of these two lines from the body, then be sure to remove the lines in the SCRIPT segment that refer to these two variables.

The remaining lines are basic input attributes of the FORM, contained within a TABLE. Two text inputs (VARIABLE1 and VARIABLE3), a drop down list input (VARIABLE2) and a text box input (VARIABLE4) are shown in the example code. There is no special order involved and you can use different types for each variables used.

<HTML>
<HEAD>
<TITLE>
BASIC JAVA DRIVEN FORM
</TITLE>
<!This code example is distributed free of charge>
<!The code was developed by R. J. Burling - compsale@nnsw.com.au>
<!The code may be modified in any way to suit the individual needs but I>
<!ask that these opening comments be retained and the development link>
<!contained at the end of the file>
<SCRIPT LANGUAGE="JavaScript">
<!--
function formDespatch() {
if (document.form1) {
document.form1.REFERENCE.value = document.REFERENCE;
document.form1.BROWSERTYPE.value = navigator.appName + " " + navigator.appVersion;
document.form1.VARIABLE1.value = document.VARIABLE1;
document.form1.VARIABLE2.value = document.VARIABLE2;
document.form1.VARIABLE3.value = document.VARIABLE3;
document.form1.VARIABLE4.value = document.VARIABLE4;
} else {
return false;
}
}
// -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
This form is Java Active. If your browser does not have Java capacity please
<A HREF="formalt.html">
Click here for alternative</A>
<P>
<FONT COLOR="#FF00FF">
Email addresses supplied will not be sold on.
</FONT>
<P>
</CENTER>
<P>
<FORM NAME="form1" METHOD="post" ACTION="mailto:your.address@provider.com.au?SUBJECT=Subject Name" ENCTYPE="text/plain">
<INPUT TYPE="hidden" NAME="REFERENCE" VALUE="Page or Site Title">
<INPUT TYPE="hidden" NAME="BROWSERTYPE" VALUE="non_Netscape">
<TABLE BORDER="1" WIDTH=470>
<TR>
<TD COLSPAN="2" WIDTH="452">
<B>
<FONT SIZE="+1">
Your details (please complete) -
</FONT>
</B>
</TD>
</TR>
<TR>
<TD WIDTH="226">
First Variable Input
</TD>
<TD WIDTH="226">
<INPUT TYPE="text" NAME="VARIABLE1" VALUE="default value" SIZE="20">
</TD>
</TR>
<TR>
<TD WIDTH="226">
List Input for Variable 2
</TD>
<TD WIDTH="226">
<SELECT NAME="VARIABLE2">
<OPTION SELECTED VALUE="None">
Variable 2
<OPTION VALUE="Data 1">
Data 1
<OPTION VALUE="Data 2">
Data 2
<OPTION VALUE="Data 3">
Data 3
</SELECT>
</TD>
</TR>
<TR>
<TD WIDTH="226">
Variable 3 Input
</TD>
<TD WIDTH="226">
<INPUT TYPE="text" NAME="VARIABLE3" VALUE="" SIZE="40">
</TD>
</TR>
<TR>
<TD COLSPAN="2" WIDTH="452">
<CENTER>
<FONT SIZE="+1">
<B>
Variable 4 as Text data input
</B>
</FONT>
</CENTER>
</TD>
</TR>
<TR>
<TD COLSPAN="2" WIDTH="452">
<TEXTAREA NAME="VARIABLE4" COLS=80 rows=8 VALUE="no information">
</TEXTAREA>
</TD>
</TR>
<TR>
</TABLE>
<TABLE BORDER="0" WIDTH=470>
<TR>
<TD WIDTH="226">
<CENTER>
<INPUT TYPE="submit" VALUE="Send Form">
</CENTER>
</TD>
<TD WIDTH="226">
<CENTER>
<INPUT TYPE="reset" VALUE="Clear Form">
</CENTER>
</TD>
</TR>
</TABLE>
</FORM>
</TD>
</TR>
</TABLE>
</CENTER>
</FORM>
<!Please retain this section>
<FONT SIZE="-2">
<P ALIGN="right">
© Design and development by <R. Burling of Compsale</A> - Jan 1999
</FONT>
</BODY>
</HTML>


MODIFICATION SERVICE

Compsale offers a modification service for those people who need it.

The cost of such modifications start at $AU25.00, depending upon the degree of expansion and change required.

To avail yourself of this service you need to contact us either by Email so that needs can be discussed and arrangements for payment worked out (payment will be required prior to sending you the prepared form).

You will need to advise us exactly what you require in your form and, if a special layout is required, we will need to see that layout. Some examples of a return form can be seen at the following locations:

Remember that your form can be modified at a later date should it be required.

Other Java script capabilities are available. Many are pre-set such as the form, whilst others can be developed. Just contact us.


REMEMBER: This code is freely available. You may modify the code in any way you like. However, we request that the developer information is retained in the section as a mark of respect to the developer.