React Form - Form Properties

To change the Form configuration at runtime, bind the property that should be changed to a state property:

App.js
  • import React from 'react';
  •  
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import { Form } from 'devextreme-react/form';
  • import { CheckBox } from 'devextreme-react/check-box';
  •  
  • const employee = {
  • firstName: 'John',
  • lastName: 'Heart',
  • phone: '+1(213) 555-9392',
  • email: 'jheart@dx-email.com'
  • };
  •  
  • class App extends React.Component {
  • constructor() {
  • super();
  • this.state = {
  • isFormDisabled: false
  • };
  • this.onCheckBoxValueChanged = this.onCheckBoxValueChanged.bind(this);
  • };
  •  
  • render() {
  • return (
  • <div>
  • <Form
  • formData={employee}
  • disabled={this.state.isFormDisabled} />
  • <CheckBox
  • text="Disable the Form"
  • value={this.state.isFormDisabled}
  • onValueChanged={this.onCheckBoxValueChanged} />
  • </div>
  • );
  • }
  •  
  • onCheckBoxValueChanged(e) {
  • this.setState({
  • isFormDisabled: e.value
  • });
  • }
  • }
  •  
  • export default App;
See Also