The ELEMENT_TYPES defines constants for identifying various UI components in Servoy. It provides values such as BUTTON, CALENDAR, and TEXT_FIELD to help developers determine an element's type and manage its behavior during scripting. Practical examples show how these constants can be used in scripts to implement specific logic based on the element type. This simplifies working with Servoy's UI components and enhances customization capabilities.
//the return value for an element type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.ACCORDIONPANEL)
{
// element is a accordion panel element
}
BUTTON
Constant representing an element of the Button type.
//the return value for an element of the Button type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.BUTTON)
{
// element is a Button component
}
CALENDAR
Constant representing an element of the Calendar type.
//the return value for an element of the Calendar type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.CALENDAR)
{
// element is a Calendar field
}
CHECK
Constant representing an element of the Check type.
//the return value for an element of the Check type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.CHECK)
{
// element is a Check(box) field
}
//the return value for an element of the TextField type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.COMBOBOX)
{
// element is a COMBOBOX element
}
//the return value for an element of the Form type, as returned by the following code
var renderElementType = event.getRenderable().getElementType();
if (renderElementType == ELEMENT_TYPES.FORM)
{
// element is a type form element
}
//the return value for an element type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.GROUP)
{
// element is a group element
}
//the return value for an element of the TextField type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.HTML_AREA)
{
// element is a HTML textarea
}
IMAGE_MEDIA
Constant representing an element of the ImageMedia type.
//the return value for an element of the ImageMedia type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.IMAGE_MEDIA)
{
// element is a Image Media field
}
LABEL
Constant representing an element of the Label type.
//the return value for an element of the Label type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.LABEL)
{
// element is a Label component
}
//the return value for an element of the ListBox type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.LISTBOX)
{
// element is a LISTBOX element
}
MULTISELECT_LISTBOX
Constant representing a multi selection listbox element.
//the return value for an element of the TextField type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.MULTISELECT_LISTBOX)
{
// element is a MULTISELECT_LISTBOX element
}
PASSWORD
Constant representing an element of the Password type.
//the return value for an element of the Password type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.PASSWORD)
{
// element is a Password component
}
PORTAL
Constant representing an element of the Portal type.
//the return value for an element of the Portal type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.PORTAL)
{
// element is a Portal component
}
RADIOS
Constant representing an element of the Radios type.
//the return value for an element of the Radios type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.RADIOS)
{
// element is a Radios field.
}
//the return value for an element of the TextField type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.RECTANGLE)
{
// element is a rectangle element
}
//the return value for an element of the TextField type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.RTF_AREA)
{
// element is a RTF textarea.
}
//the return value for an element of the Spinner type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.SPINNER)
{
// element is a SPINNER element
}
//the return value for an element type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.SPLITPANE)
{
// element is a splitpane element
}
TABPANEL
Constant representing an element of the Tabpanel type.
//the return value for an element of the Tabpanel type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.TABPANEL)
{
// element is a Tabpanel component
}
TEXT_AREA
Constant representing an element of the TextArea type.
//the return value for an element of the TextArea type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.TEXT_AREA)
{
// element is a TextArea field
}
TEXT_FIELD
Constant representing an element of the TextField type.
//the return value for an element of the TextField type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.TEXT_FIELD)
{
// element is a text field
}
//the return value for an element of the TextField type, as returned by the following code
var etype = elements.elementName.getElementType();
if (etype == ELEMENT_TYPES.TYPE_AHEAD)
{
// element is a type ahead element
}