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

Dynamic Fields

Sometimes you need to create your Form out of dynamic data, e.g. from data you received from a server. This is mostly the case when using checkboxes, radio groups, or select fields.

For example: you could receive the data from the server and than use setState to set the data for your checkboxes, radio groups, and select fields used in your <Form /> component.

async componentDidMount() {
const response = await getDataFromServer();
this.setState({
checkboxData: response.data.checkboxData,
selectData: response.data.selectData,
radioData: response.data.radioData,
});
}

Than in your render function you would return something like:

name 1
name 2
name 3