availity-react icon indicating copy to clipboard operation
availity-react copied to clipboard

Automatically add required attribute to @availity/form inputs

Open nylon22 opened this issue 5 years ago • 3 comments

Automatically add required attribute to @availity/form, @availity/select, and @availity/date inputs when required from yup or isRequired from @availity/yup returns true.

See https://github.com/Availity/availity-react/pull/243#discussion_r316252370

nylon22 avatar Aug 21 '19 15:08 nylon22

As of today [email protected] that is possible.

https://codesandbox.io/s/reactstrap-formik-with-validate-25i8j

Note that it works for a mix of both

GoPro16 avatar Aug 21 '19 19:08 GoPro16

Similarly, all HTML5 validation attributes: required, pattern, minlength, maxlength.

TheSharpieOne avatar Aug 21 '19 22:08 TheSharpieOne

There does not appear to be a clean way to do this atm. Will continue to monitor formik issues. I did find this: https://github.com/jaredpalmer/formik/issues/1728

nylon22 avatar Oct 10 '19 20:10 nylon22