React Form Package
Edit page
IntroductionInstallationFormSimple FormButtonFieldFieldWrapperRadioGroupSelectForm ValidationStateonFocus onChange onBlurState ManipulationCustom Error MessagesFeedback on disabled ButtonStylingDynamic FieldsDynamic Fields 2Dynamic Fields 3Bind Input FieldsBind an input value to another input valueBind Input Fields 2Third Party ComponentsFile UploadWhy

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.

PropertyTypeRequiredDefaultDescription
bindToStringfalsethe id of the field you want to manipulate
bindToCallbackFuncfalsethe 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.

House numbers:
Households: