Processing forms

Forms are processed by the script or application specified in the ACTION attribute of the FORM tag. Select a form and look in the Property inspector to see what the associated action is.

The simplest forms use JavaScript or VBScript to perform all form processing on the client side (as opposed to sending the form data to the server for processing). For example, you might have a small form at the bottom of a page that contains only two radio buttons labeled Yes and No, plus a Submit button. The form action might be a JavaScript function defined in the HEAD of the document that jumps to one document if the user selects Yes and to a different document if the user selects No:

function processForm(){
  if (document.forms[0].elements[0].checked){
    window.location.href = "userAnsweredYes.html";
  }else{
    window.location.href = "userAnsweredNo.html";
  }
}

To use a client-side JavaScript function as the form action:

1 Select a form.
2 In the Property inspector, type javascript: followed by the name of the function in the Action field: for example, javascript:processForm(). Do not put a space between the colon and the name of the function.

You can handle lots of form processing tasks using client-side scripting, but you can't save the data entered by the user or send it to someone else. For this you need a server-side application such as a Common Gateway Interface (CGI) script. CGI scripts can be written in Perl, C, Java, or another programming language. There are several sites on the web that offer free CGI scripts that you can either use as is or modify to fit your needs. See HTML resources. You can also ask your Internet service provider or web team if there are any CGI scripts that are already configured to run on your server that you can use.