diff options
| author | Zog | 2018-04-24 09:13:02 +0200 | 
|---|---|---|
| committer | Zog | 2018-04-24 09:13:02 +0200 | 
| commit | ecfab26b71c713c17206f7dbe7925fbea17df3a6 (patch) | |
| tree | 74afc24d18ca9e1887f7e58b92b5f7b33b2e37a0 | |
| parent | d521797a4ca3e668934c6a767f0c2b357824107d (diff) | |
| download | chouette-core-ecfab26b71c713c17206f7dbe7925fbea17df3a6.tar.bz2 | |
Use CustomFields default values in React components
| -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()} }          />      ) | 
