ctx.getValue()
In editable field scenarios such as JSField and JSItem, use this to get the latest value of the current field. Combined with ctx.setValue(v), it enables two-way binding with the form.
Scenarios
Note:
ctx.getValue()is only available in RunJS contexts with form binding; it does not exist in scenarios without field binding, such as workflows or linkage rules.
Type Definition
- Return Value: The current field value, whose type is determined by the field's form item type; it may be
undefinedif the field is not registered or not filled.
Retrieval Order
ctx.getValue() retrieves values in the following order:
- Form State: Prioritizes reading from the current state of the Ant Design Form.
- Fallback Value: If the field is not in the form, it falls back to the field's initial value or props.
If the form has not finished rendering or the field is not registered, it may return
undefined.
Examples
Render based on current value
Two-way binding with setValue
Related
- ctx.setValue() - Set the current field value, used with
getValuefor two-way binding. - ctx.form - Ant Design Form instance, for reading/writing other fields.
js-field:value-change- Container event triggered when external values change, used to update the display.

