mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Merged in AD-589-Form-Cancel-doesnt-reset (pull request #16)
Form cancel doesnt reset property/form
This commit is contained in:
commit
da7be7bb06
@ -328,8 +328,7 @@ let EditionPersonalNote = React.createClass({
|
||||
rows={1}
|
||||
editable={true}
|
||||
defaultValue={this.props.edition.note_from_user}
|
||||
placeholder={getLangText('Enter a personal note%s', '...')}
|
||||
required="required"/>
|
||||
placeholder={getLangText('Enter a personal note%s', '...')}/>
|
||||
</Property>
|
||||
<Property hidden={true} name='bitcoin_id'>
|
||||
<input defaultValue={this.props.edition.bitcoin_id}/>
|
||||
|
@ -57,13 +57,15 @@ let Property = React.createClass({
|
||||
});
|
||||
}
|
||||
|
||||
this.setState({
|
||||
initialValue: this.refs.input.getDOMNode().defaultValue
|
||||
});
|
||||
if(!this.state.initialValue) {
|
||||
this.setState({
|
||||
initialValue: this.refs.input.getDOMNode().defaultValue
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
reset(){
|
||||
// maybe do reset by reload instead of frontend state?
|
||||
// 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
|
||||
@ -117,7 +119,10 @@ let Property = React.createClass({
|
||||
handleSuccess(){
|
||||
this.setState({
|
||||
isFocused: false,
|
||||
errors: null
|
||||
errors: null,
|
||||
|
||||
// also update initialValue in case of the user updating and canceling its actions again
|
||||
initialValue: this.refs.input.getDOMNode().value
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user