0

How to disable submit button until all fields are filled in in reactjs with redux-forms. To be more specific i have a form that consists only from radio buttons. So for every question there is 5 radio buttons to choose from. And i want by submit button to be disabled until all question are answered.

3
  • Possible duplicate of React.js: Disable button when input is empty Commented May 2, 2018 at 17:41
  • Not duplicate, this is specific for redux form how to sync validate form on every change Commented May 2, 2018 at 17:45
  • kindly add your code snippet. Commented May 2, 2018 at 17:48

1 Answer 1

0

You need to leverage sync validation as shown here https://redux-form.com/6.6.3/examples/syncvalidation/ this will validate whole form if it's valid and pass necessary props to the component https://redux-form.com/6.6.3/docs/api/props.md/

invalid, valid

Then you can just bind disabled={invalid}

I created a sandbox to better illustrate it

Edit Redux Form - Synchronous Validation

Sign up to request clarification or add additional context in comments.

1 Comment

Additionally, you can still leverage invalid and valid if you are using field level validation, which adapts as the user interacts with a field (as opposed to when the form is submitted)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.