Skip to content
Snippets Groups Projects
Commit 01ef1d48 authored by Tamlyn Rhodes's avatar Tamlyn Rhodes
Browse files

Show all form errors when submit button is clicked

parent 86d80e8f
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