next up previous
Next: Extending the Package Up: Predicates for Generating HTML Documents Previous: Specific Structures

Specific Structures for Forms

 

HTML forms are HTML documents (or parts of HTML documents) which, when accessed via a form-capable browser (Mosaic, netscape, etc.), allow the user to perform input through text areas, menus, radio buttons, etc. This input is not ultimately handled by the browser. Instead, forms generally have a ``submit'' button. When this button is pressed, the input provided through the menus, text areas, etc. is sent by the browser to a ``handler'' program, which can be anywhere on the net. The sending browser then waits for a response from that program, which comes in the form of a new HTML document. See for example this document for details.

The following HTML terms provide a simple way of producing forms from a Prolog program:

 
form(Addr)
Specifies the beginning of a form. Addr is the address (URL) of the program that will handle the form (translates to <form method="POST" action="Addr">).

end_form
Specifies the end of a form (translates to </form>)

checkbox(Name,State)
Specifies an input of type checkbox with name Name, State=on if the checkbox is initially checked (translates to an <input> element).

radio(Name,Value,Selected)
Specifies an input of type radio with name Name (several radio buttons which are interlocked must share their name), Value is the the value returned by the button, if Selected=Value the button is initially checked (translates to an <input> element).

input(Type,Atts)
Specifies an input of type Type with a list of attributes Atts. Possible values of Type are text, password, submit, reset, ...(translates to an <input> element).

textarea(Name,Atts,Text)
Specifies an input text area of name Name. Text provides the default text to be shown in the area, Atts a list of attributes (translates to a <textarea> environment).

menu(Name,Atts,Items)
Specifies a menu of name Name, list of attributes Atts and list of options Items. The elements of the list Items are marked with the prefix operator `$' to indicate that they are selected (translates to a <select> environment).

form_reply
This is not HTML, rather, the HTTP protocol requires this content descriptor to be used by form handlers when replying (translates to ``Content-type: text/html'').


next up previous
Next: Extending the Package Up: Predicates for Generating HTML Documents Previous: Specific Structures

Mon Mar 18 21:38:39 MET 1996 <clip@dia.fi.upm.es>