<fx-control>

Description

fx-control is no concrete control displayed in the browser but instead wraps such a control and binds it to a data node in the model with the help of a ref attribute.

Attributes

NameDescriptionDefault
as’text’ or ’node’. When using ’node’ a whole dom tree can be passed to a widgettext
contextXPath reference pointing to parent contextincopeContext
credentialssets credentials policy - one of ‘omit’, ‘same-origin’ or ‘include’same-origin
createif present on control or anchestor will create non-existing attribute nodes in the data-
debounceoptional numeric value in milliseconds to delay input events-
initialXPath binding expression referring to data that get passed to Fore control as default instance. Only effective when url is specified.-
labeloptional label-
listen-ona CSS selector to attach the update event listener toelement with ‘widget’ class
refXPath reference pointing to the bound node-
shadowmarker attribute to attach Fore control to shadowDOM instead of lightDOM-
update-eventoptional event name when to trigger updating of bound node.blur
’enter’ can be used to catch enter key
urlURL pointing to HTML page containing fx-fore element that gets imported as widget-
value-propoptional property name used to set the value of the widget (default:‘value’)value

Attributes on widgets

A widget is an element contained within a <fx-control> and must be marked with a class="widget".

Some attributes might occur on a widget to further control its behavior.

NameDescription
selectionapplies to <select> elements. If selection="open" is given an additional empty <option> will be added to allow the empty value.

Events

NameDescription
initdispatched once when a control is initialized. Can be used for customization of wrapped widgets.
value-changeddispatched during refresh after the value of the control has changed
optionaldispatched during refresh when node has become optional
requireddispatched during refresh when node has become required
readonlydispatched during refresh when node has become readonly
readwritedispatched during refresh when node has become readwrite
validdispatched during refresh when node has become valid
invaliddispatched during refresh when node has become invalid
relevantdispatched during refresh when node has become relevant
nonrelevantdispatched during refresh when node has become non-relevant

Special features

passing referenced node as node instead of value

With the ´as´ attribute the referenced node will be directly passed to the widget. This can be useful with control that manipulate nodes like e.g. text editors.

creating selects with an empty option

Sometimes values can and should be empty initially. With selection="open" on the select element it will create such en empty option.

using Fore as control

By setting a url attribute you can use another ForeBody as the widget of given control. The url is resolved and will fetch the first fx-fore element it finds within that page and embeds it as widget of the control. You can pass in an fx-instance for the loaded widget with initial and get the return value with the return action.

Examples