<updateValue>
<updateValue> is a General Operator
component that changes the value or property of a named component based on a button click interaction or a boolean condition.
Attributes and Properties
Attributes for <updateValue>
Labels (1)
labelIsNameboolean. Default value: false. Whether to use this component's name as its rendered label.
Positioning (2)
anchorpoint. Default value: . Coordinates of the anchor point used to position this component on a graph.
positionFromAnchorkeyword. Where this component sits relative to its anchor point.
| Value | Description |
|---|---|
upperRight | Place the component above and to the right of the anchor point. |
upperLeft | Place the component above and to the left of the anchor point. |
lowerRight | Place the component below and to the right of the anchor point. |
lowerLeft | Place the component below and to the left of the anchor point. |
top | Place the component directly above the anchor point. |
bottom | Place the component directly below the anchor point. |
left | Place the component directly to the left of the anchor point. |
right | Place the component directly to the right of the anchor point. |
center (default) | Center the component on the anchor point. |
Triggering (4)
boolean. Default value: false. Boolean expression that fires the action whenever it transitions to true.
reference. References to components whose click events should fire this action.
triggerWhenObjectsFocusedreference. References to components whose focus events should fire this action.
reference. References to components whose value changes should fire this action.
Other (5)
draggableboolean. Default value: true. Whether the update button can be dragged on a graph.
_componentWithSelectableType. New value to assign to the target.
simplifykeyword. Level of simplification applied to the new value.
| Value | Description |
|---|---|
none (default) | No simplification is applied. |
full | Fully simplify the new value. |
numbers | Simplify numeric subexpressions only, leaving symbolic structure intact. |
numbersPreserveOrder | Like numbers, but does not reorder commutative operands. |
normalizeOrder | Reorder commutative operands into a canonical form without simplifying values. |
reference. Reference to the state variable that will be updated.
keyword. Component type used to interpret the new value.
| Value | Description |
|---|---|
math | Treat the new value as a math expression. |
number | Treat the new value as a number. |
boolean | Treat the new value as a boolean. |
text | Treat the new value as text. |
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
boolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <updateValue name="u">
Labels (2)
$u.labellabel. The label rendered with this component.
$u.labelIsNameboolean. Whether to use this component's name as its rendered label.
Positioning (2)
$u.anchorpoint. The coordinates where this component is anchored on the graph.
$u.positionFromAnchortext. Where this component sits relative to its anchor point.
Other (6)
$u.disabledboolean. Whether this component is disabled and cannot be interacted with.
$u.draggableboolean. Whether the update button can be dragged on a graph.
$u.fixedboolean. Whether this component's value is fixed and cannot be modified.
$u.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$u.simplifytext. Level of simplification applied to the new value.
Common to all components (4)
$u.doenetMLtext. The DoenetML source code that produced this component.
$u.hideboolean. Whether to hide this component from the rendered output.
$u.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$u.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Change the color of a <circle>
An <updateValue> is used to change the styleNumber property of a named <circle> from the default value () to . Once this change occurs, the button becomes disabled.
Example: Change the value of a <number>
An <updateValue> is used to change the value of a <number> based on the number’s current value.
Attribute Examples
Attribute Example: target
The target attribute specifies which component or component property to update.
Attribute Example: type
The type attribute specifies the type of component that is changing. The default type is math, and valid values are math, number, boolean, or text.
Attribute Example: newValue
The newValue attribute specifies the new value for the target or target property.
Attribute Example: disabled
The disabled attribute takes a boolean condition. When the condition evaluates to true, the button becomes disabled.
Attribute Example: triggerWhen
The triggerWhen attribute establishes a boolean condition for triggering when the value should be updated. In this case, the circle turns blue when the correct answer is entered.
Attribute Example: triggerWith
The triggerWith attribute allows the update to occur based on interaction with another specified component. In this way, the actions of two or more <updateValue> components may be chained together.
Attribute Example: triggerWhenObjectsClicked
Updates can be triggered by click interactions with graphical components defined within a <graph> using the triggerWhenObjectsClicked attribute.