Availity / availity-reactstrap-validation

Easy to use React validation components compatible for reactstrap.
https://availity.github.io/availity-reactstrap-validation/
MIT License
191 stars 70 forks source link

Get all the values of AvForm without submit button #220

Closed hungdev closed 3 years ago

hungdev commented 3 years ago

is there any way to get all the values of AvForm without using submit button, for example get values via ref....

hungdev commented 3 years ago

I found out. use this.form.getValues() for get all and this.form.getValue('name') for get field name Example for who want to know: https://codesandbox.io/s/romantic-hooks-ky9o2?file=/src/App.js:766-787 and beside that i found more useful func. Look at the image. image

AbhaysinghBhosale commented 3 years ago

Is there any way to get it working for select input. As i did used "this.formRef.current.getValues()" which does not return value of select dropdown.

`<AvField type="select" id="Role" name="Role" label={Resource.lblUserRole} value={this.state.User && this.state.User['Role']} required>

                                        <option value="Admin">UserRoles1</option>
                                        <option value="Reader">UserRoles2</option>
                                    </AvField>`

i do get values in onKeyDown={this.onKeyDown} method to detect if values in form and original values are updated