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/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
<Button
type="button"
primary
onClick={toggleConfirming}
disabled={!valid}>
onClick={toggleConfirming}>
Submit your manuscript
</Button>
</div>
......
......@@ -76,8 +76,13 @@ export default compose(
}),
withState('confirming', 'setConfirming', false),
withHandlers({
toggleConfirming: props => () => {
props.setConfirming(confirming => !confirming)
toggleConfirming: ({valid, setConfirming, handleSubmit}) => () => {
if (valid) {
setConfirming(confirming => !confirming)
} else {
// trigger dummy submit to mark all fields as touched
handleSubmit(() => {})()
}
}
})
)(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