OpenWGA 7.6 - OpenWGA Concepts and Features
Design and development » WebTML » FeaturesForms
WebTML forms is a feature of WebTML to integrate input forms into WebTML pages and connect their data seamlessly to OpenWGA.
The concept of form definition in WebTML mostly matches the one known from HTML forms, as which they are actually put out. Just like in HTML there is a special tag <tml:form> which introduces a WebTML form definition. Inside this definition tags named <tml:input> definie input fields of the form.
<tml:form id="theform">
Surname: <tml:input name="surname" type="text"/>
Given name: <tml:input name="givenname" type="text"/>
</tml:form>
The id attribute, available on all WebTML and normally optional, is mandatory on the <tml:form> tag.
WebTML forms differ from normal HTML forms by the following behaviours:
- WebTML forms aren't stored just by submitting them. Instead WebTML actions are used which define the operations that can be done on a form, including storing the information somewhere, but also changing input values, recalculating dependent fields and the such.
- The input fields of a WebTML form may have an automatic data binding to some data source. This may be a content document, but also the users personalisation profile or a WebTML portlet configuration. Input fields whose names match items of the data backend will automatically contain the item data. Also the data of a WebTML form may directly be stored back into the items of the data source..
- WebTML forms are protected from maliciously adding data fields on the client side. They ignore HTML fields that are not defined in their form definition on the server side.
- They manage uploaded files. When using a content document as data source they also synchronize files between the document and the form. Add/Remove/Update operations on form files will also be performed on the backend document once the form data is stored back.
- They support additional high-level features like automatic validation, persistence, a process context for storing arbitrary data and more.
In TMLScript a WebTML form is represented by the TMLForm object. It can be used to modify the forms field values and other data in WebTML actions or simple <tml:script> scripts running while the page is rendered.
While WebTML forms are the tool of choice for getting input from the website user they are NOT (directly) intended for building content authoring interfaces in OpenWGA. The functionality for authoring is built around <tml:item> and its editor attribute. See chapter Authoring for details of this concept.
It is however possible to use WebTML form inputs as editors when authoring items, by using editor="custom". That way the <tml:item> tag can be used like a <tml:form> tag and may contain one or multiple <tml:input> fields in its content which then make up the editor.
Table of contents:
- Input fields
- Data binding and storage
- Form files
- Validation
- Storing content relations
- Process context
- Persistent forms