Skip to content
Snippets Groups Projects
Commit 78a53c77 authored by Yannis Barlas's avatar Yannis Barlas
Browse files

Merge branch 'show-submission-errors' into 'master'

Show all form errors when submit button is clicked

See merge request xpub!50
parents 01adc5da 01ef1d48
No related branches found
No related tags found
No related merge requests found
...@@ -36,8 +36,7 @@ const Submit = ({ project, version, valid, error, handleSubmit, uploadFile, conf ...@@ -36,8 +36,7 @@ const Submit = ({ project, version, valid, error, handleSubmit, uploadFile, conf
<Button <Button
type="button" type="button"
primary primary
onClick={toggleConfirming} onClick={toggleConfirming}>
disabled={!valid}>
Submit your manuscript Submit your manuscript
</Button> </Button>
</div> </div>
......
...@@ -76,8 +76,13 @@ export default compose( ...@@ -76,8 +76,13 @@ export default compose(
}), }),
withState('confirming', 'setConfirming', false), withState('confirming', 'setConfirming', false),
withHandlers({ withHandlers({
toggleConfirming: props => () => { toggleConfirming: ({valid, setConfirming, handleSubmit}) => () => {
props.setConfirming(confirming => !confirming) if (valid) {
setConfirming(confirming => !confirming)
} else {
// trigger dummy submit to mark all fields as touched
handleSubmit(() => {})()
}
} }
}) })
)(Submit) )(Submit)
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