Start page
Start page

Start page / Template development / Template syntax / Data types / FormData

FormData data type

Combinations from the form definition and values recorded with this are also described as FormData objects. For example, this comprises all input components of a template including saved values.

Generally, the content of the name variable identifier, which is defined on the form tab of a template (for more information, also see the Forms area), can be output on the presentation channel tab of the same template simply using $CMS_VALUE(...)$ or $CMS_REF(...)$. To output the content of a referenced object (e.g., using FS_REFERENCE), FormData from the object can be used.

FormData objects are therefore returned by various FirstSpirit elements.

From a FormData object, it is possible to use the get(Language, String) method to access the FormField. This involves precisely one input component and the language-dependent content of the FormData object. The identifier of the required input component is specified in the method (within double quotation marks), as is the required language, e.g.,

.get(#global.language, "IDENTIFIER").get

Using the following simplified syntax, it is possible to access the content of a FormField in the language currently being rendered:

.formData.IDENTIFIER

In such cases, IDENTIFIER is the identifier of the input component whose content is to be accessed.

Methods for FormData objects

The tables below list all the methods that can be called for objects of the FormData data type:

Method name Return type Brief description Available since
compareTo(Comparable) int
equals(Object) boolean
get(Language, String) FormField Outputting the FormField
getClass Class Class of the invoking object
getForm GomEditorProvider
isCase(Object) boolean
isNull boolean Checks whether an expression is null (zero)
print void
set(String, Object) Object
toJson String Convert to JSON string representtion (only handles Maps, Collections, Arrays, Numbers, and Strings) 4.2.14
toString String
type String

compareTo(Comparable)

Method name Return type Available since
compareTo(Comparable) int

equals(Object)

Method name Return type Available since
equals(Object) boolean

get(Language, String)

The .get(Language, String) method can be used to access the FormField in a particular language. This involves precisely one input component and the language-dependent content of the FormData object. The identifier of the required input component is specified in the method (within double quotation marks), as is the required language, e.g.,

$CMS_VALUE(IDENTIFIER.formData.get(#global.language, "IDENTIFIER2").get)$

Using the following simplified syntax, it is possible to access the content of a FormField in the language currently being rendered:

$CMS_VALUE(IDENTIFIER.formData.IDENTIFIER2)$
Method name Return type Available since
get(Language, String) FormField

getClass

The .getClass() (in Bean syntax: .class) method returns the class of the invoking object (cf. java.lang.Class).

Invocation:

$CMS_VALUE(myString.class)$
$CMS_VALUE(myString.getClass())$

Output:

java.lang.String
Method name Return type Available since
getClass Class

getForm

Method name Return type Available since
getForm GomEditorProvider

isCase(Object)

Method name Return type Available since
isCase(Object) boolean

isNull

The .isNull() (in Bean syntax: .isNull) method checks whether an expression or object is null , e.g. storeElement.isNull(). In the case of objects with complex values or objects, the object decides when it is null. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isNull() returns a Boolean value as the check result. true is the check result if the expression or object is null and false if not.

Method name Return type Available since
isNull boolean

print

Method name Return type Available since
print void

set(String, Object)

Method name Return type Available since
set(String, Object) Object

toJson

Convert to JSON string representtion (only handles Maps, Collections, Arrays, Numbers, and Strings)
Method name Return type Available since
toJson String 4.2.14

toString

Method name Return type Available since
toString String

type

Method name Return type Available since
type String

© 2005 - 2015 e-Spirit AG | All rights reserved. | Last change: 2014-10-21