Forms class

From PhiWiki
Jump to: navigation, search

The Forms class offers functions to reset and submit formular data. Currently only one form is available in Phi with the instance named phiform. The Forms class is available in the client (browser) scripting environment only.

Until now Phi limits each page to contain only one formular.

Usage

You have to address the form in Phi documents with the phiform instance of this class:

var myform=window.document.forms.phiform;
myform.reset();

Properties

  • String action [read|write]
  • String encoding [read]
  • String method [read]

String action

Sets or reads the action for this document.

var action=window.document.forms.phiform.action;
window.document.forms.phiform.action='/path/processform.phis';

See also: document.action.

String encoding

In Phi this is always multipart/form-data and can currently not be set.

var enctype=window.document.forms.phiform.encoding;

String method

In Phi this is always POST and can currently not be set.

var method=window.document.forms.phiform.method;

Functions

Void reset()

Resets the formular (same effect as if a Reset button is clicked).

window.document.forms.phiform.reset();

Void submit()

Submits the form (same effect as if a Submit button is clicked).

window.document.forms.phiform.submit();

See also: phi.onsubmit().

Additional notes

The properties length, name and target are currently not suppported.