mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Merged in AD-589-Form-Cancel-doesnt-reset (pull request #31)
fix property reset function
This commit is contained in:
commit
716d680d0f
@ -70,9 +70,9 @@ let Property = React.createClass({
|
||||
});
|
||||
}
|
||||
|
||||
if(!this.state.initialValue) {
|
||||
if(!this.state.initialValue && childInput.props.defaultValue) {
|
||||
this.setState({
|
||||
initialValue: childInput.defaultValue
|
||||
initialValue: childInput.props.defaultValue
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -80,13 +80,12 @@ let Property = React.createClass({
|
||||
reset() {
|
||||
// maybe do reset by reload instead of front end state?
|
||||
this.setState({value: this.state.initialValue});
|
||||
if (this.refs.input.state){
|
||||
// This is probably not the right way but easy fix
|
||||
|
||||
// resets the value of a custom react component input
|
||||
this.refs.input.state.value = this.state.initialValue;
|
||||
}
|
||||
else{
|
||||
|
||||
// resets the value of a plain HTML5 input
|
||||
this.refs.input.getDOMNode().value = this.state.initialValue;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user