Skip to content
Snippets Groups Projects
Commit 3045e90a authored by Alf Eaton's avatar Alf Eaton
Browse files

Simplify the onSubmit handler

parent 2082513f
No related branches found
No related tags found
No related merge requests found
...@@ -36,12 +36,9 @@ class DeclarationQuestions extends React.Component { ...@@ -36,12 +36,9 @@ class DeclarationQuestions extends React.Component {
this.setState({ declarations }) this.setState({ declarations })
} }
changed = (declarations) => { onChange = (declarations) => {
this.setState({ declarations }) this.setState({ declarations })
} // TODO: save changed declarations automatically?
save = () => {
this.props.save(this.state.declarations)
} }
autoresize = name => () => { autoresize = name => () => {
...@@ -54,15 +51,16 @@ class DeclarationQuestions extends React.Component { ...@@ -54,15 +51,16 @@ class DeclarationQuestions extends React.Component {
render () { render () {
const { declarations = {} } = this.state const { declarations = {} } = this.state
const { save } = this.props
// TODO: only display "submit" once declarations are complete // TODO: only display "submit" once declarations are complete
return ( return (
<div className="questions questions-reset content-metadata"> <div className="questions questions-reset content-metadata">
<FRC.Form <FRC.Form
onSubmit={this.save} onSubmit={save}
validateOnSubmit={true} validateOnSubmit={true}
onChange={this.changed} onChange={this.onChange}
layout="vertical"> layout="vertical">
<div className="question-section"> <div className="question-section">
<div className="question-section-heading">PART I - Questions about ethics</div> <div className="question-section-heading">PART I - Questions about ethics</div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment