Bind Input Fields
Sometimes a input value depends on another input value, e.g. the use inputs a range of house numbers and you have to calculate the dependend household count. So that the user is able to skip some fields but is also able to chnage the value if the user knows it better.
Bind an input value to another input value
To handle such cases there are two properties available on the <Field />
, the <RadioGroup />
, and the <Select />
component.
Property | Type | Required | Default | Description |
---|---|---|---|---|
bindTo | String | false | the id of the field you want to manipulate | |
bindToCallback | Func | false | the callback to set the target's (bindTo ) input value, which gets called onChange |
Basic Usage
In our example we bind our first housenumbers
input to the second households
input. As long as the bound input field (bindTo
, in our example the households field) is untouched (not blurred) the binToCallback
will be executed onChange
of the field where we have the bindTo
and bindToCallback
properties. The bindToCallback
expects a String as return value, and gets the input value of the current input field housenumbers
.