diff options
| author | Zog | 2018-04-24 09:13:02 +0200 | 
|---|---|---|
| committer | Johan Van Ryseghem | 2018-04-25 15:46:33 +0200 | 
| commit | ab364ef9fc964a23292c64e8952783c8fd26fbb3 (patch) | |
| tree | 0d2b18eeb306f1b66f6894b12801e746382a07c0 /app/javascript/helpers | |
| parent | c3e6817f2cb2e35c90434574efac256d62636830 (diff) | |
| download | chouette-core-ab364ef9fc964a23292c64e8952783c8fd26fbb3.tar.bz2 | |
Use CustomFields default values in React components
Diffstat (limited to 'app/javascript/helpers')
| -rw-r--r-- | app/javascript/helpers/CustomFieldsInputs.js | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/app/javascript/helpers/CustomFieldsInputs.js b/app/javascript/helpers/CustomFieldsInputs.js index abc8097d5..9547021eb 100644 --- a/app/javascript/helpers/CustomFieldsInputs.js +++ b/app/javascript/helpers/CustomFieldsInputs.js @@ -16,7 +16,7 @@ export default class CustomFieldsInputs extends Component {          })}          ref={'custom_fields.' + cf.code}          className='form-control' -        defaultValue={cf.value} +        defaultValue={cf.value || cf.options.default}          disabled={this.props.disabled}          options={{            theme: 'bootstrap', @@ -34,7 +34,7 @@ export default class CustomFieldsInputs extends Component {          ref={'custom_fields.' + cf.code}          className='form-control'          disabled={this.props.disabled} -        value={cf.value} +        value={cf.value || cf.options.default}          onChange={(e) => {this.props.onUpdate(cf.code, e.target.value); this.forceUpdate()} }          />      ) @@ -47,7 +47,7 @@ export default class CustomFieldsInputs extends Component {          ref={'custom_fields.' + cf.code}          className='form-control'          disabled={this.props.disabled} -        value={cf.value} +        value={cf.value || cf.options.default}          onChange={(e) => {this.props.onUpdate(cf.code, e.target.value); this.forceUpdate()} }          />      ) | 
