Menu

bound-value

An HTML content command that can be used in screens to make an input element able to modify the value of a Screen data variable. It can also be used in non-screen HTML to just display the value of that variable.

The primary attribute expression of this command is expected to refer to a Screen data variable. The host element's value will then be set to the resolved value of the expression. When the screen is submitted, the input's value at the time becomes the new value for whatever variable or property the primary attribute expression targets. Input elements of different types are suited for modifying String, Number, Boolean and Date values, so the primary attribute expression should resolve into a value of one of these types.

It is recommended that the host input element has a type attribute with a value suited for the kind of value bound-value is setting for it. For example, if bound-value brings a Date value into the input, a type value of "date" would be a good match.

If bound-value is evaluated in uneditable content (a composeContent command whose editable attribute is false does this), this content command's functionality changes. It will transform its host element into a span and set its primary attribute's resolved value as the text content of that span, in a fairly similar manner to how the HTML content command content would operate.

This command has a priority of 15 if evaluated in HTML content declared as uneditable. Otherwise its priority can be considered to be lower compared to all other HTML content commands besides bound-repeat, which operates at a higher priority. 

Secondary attributes

bound-value-of-repeat


Required
Value type
EL-evaluated
No
String
No
This attribute can be used to link this bound-value to a bound-repeat, allowing this command to access that bound-repeat's contents even if this command's host element is not inside bound-repeat's host element. The resolved value of this attribute should match the bound-repeat-name value of the bound-repeat that this command should be linked to.

When using this link, the primary attribute expression of bound-value can use one of two possible fixed variable names to access an item of the bound-repeat's Collection; which one to use depends on what kind of functionality is sought:
  • targetItem - The host input modifies a value of the currently targeted item of the bound-repeat's Collection, switching as the targeted item changes. 
  • nextItem - The host input defines a value for the next item to be added to the bound-repeat's Collection. 
Note that this attribute has no effect if this command is evaluated in uneditable content.

Examples

Leaving the type attribute of the host input element undefined makes it a text input, which is generally not optimal for non-String value types. Some type values that might come useful are "number" and "date", for Number and Date values respectively.  

<input bound-value="item.name"/>
<input type="number" bound-value="item.quantity" />
<input type="date" bound-value="item.deliveryDate" />

For examples on the uses of the bound-value-of-repeat attribute, please see the examples section of bound-repeat.

Comments

0 comments