I am using react hook form accepting various fields, I want to enable the button only when
A date is selected from the controller with KeyboardDatePicker component
A radio button selection is made
An autocomplete selection should select a desired value. If the value selected in not the one that we desire the button should be disabled.
How can I achieve this use case. I tried using isDirty, dirtyFields, isValid, touched and they were not helpful as both of them do not provide the value of the ids controlled using react hook form. Also I need to get the values of the radio button but with these props it is returned true, irrespective of the value selected.
Related
i want change field value when click in edit button actually when click in button change value of input field
I am currently using antd-form-builder to build multiple JSON forms for different components and I have an issue with antd trying to use a checkbox to disable another input.. basically I have a function that returns the form meta fields and then in the onChange for the checkbox I am trying to set another field to become disabled
what I have managed to find so far is for the form ref there is a setFields function and I can use this to change the value of another field or the errors on that field through the onChange of the checkbox, however, I cannot change the disabled state of another field.
turns out, this cant be done .. and state variables should be used as mentioned in the issue here
I want to basically know if I am having rows selected to activate an input, the thing is
"selectionChange" event is not capturing when the selection is being changed I have a small example.
https://codesandbox.io/s/ag-grid-react-redux-events-forked-459v6?file=/index.js
What id expect to happen is to get the alert to show when something is selected on this example.
Turns out in React this property is onSelectionChange, following react pattern
I have a component with a checkbox and text field when the user clicks the checkbox I am showing the text field which is hidden by default. To achieve this functionality I am using state of this component, as user checks the checkbox I am calling onChangeHandler and setting the state to showAccountNumberField text field and when user unchecks the checkbox hiding the text field. But when I am trying to test this component by doing
wrapper.setSatate({showAccountNumberField: true})
I am getting error that state can only be accessed on class component. I am using React 16 and Jest for unit testing. Any help is appreciated.
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.
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