Releases: willowtreeapps/react-formable
2.3.0
2.2.0
V2
Validation bugs
This release has the potential to introduce regressions in validation. I am going to cut the major release soon to avoid any further conflicts.
Before we would default the value
passed to validators to an empty string if the value itself was falsey. This caused issues with true falsey values such as 0
and false
. Now, we don't default value
to anything which means you need to check if it exists before you test it.
IE support
Lowers target version down to es5 for better support in IE
Minor bug fixes
This bump fixes a few small bugs and missing inputs:
- Pressing enter in a
textarea
no longer triggersonSubmit
- Prevents the form from validating with the default HTML validators
- Passes down extra props to the form (
className
, etc)
onSubmit changes
Two notable changes here:
- Changed the types for react to not be included in the build (needs more testing)
- The form no longer calls
onSubmit
if the form is invalid. You can optionally supplynoValidate
to the form, this will then callonSubmit
regardless of the form state withvalidation
as its second parameter.
V2 Alpha Release
We are bumping this to 2.0 to avoid any conflicts / confusions with people already on the 1.0 branch.
Notable changes
The API is experimental at this point, so use with caution. Names could change, however the general structure may change.
- We have moved away from using refs for inputs. Now instead of needing to define
getValue
on each of your inputs, you should haveonChange
which returns the standard event. This means formable works with native inputs (and more) out of the box and plays nicely with decorated components. You can customize how this behaves to accommodate any input. If you want to attach a ref to an input, use callback refs. - Validation accepts promises. This is similar to how 1.0 worked
- No more
Fieldset
orFieldlist
. Now, you can attachname
to any tag and it will start a new context. Similarly, if you have multiple inputs with the samename
, it will turn them into an array. - Debounced and dirty validation. You can now optionally debounce validation as well as only validate dirty fields. This allows for better experience with showing errors on change.
- Much more customization. You can customize almost every aspect for formable now. From how errors get passed down to individual inputs, to how various inputs serialize, and more.
Gotchas
There are a few things that have changed from 1.0 that could cause issues.
- On change now optionally receives
fieldErrors
. Since validation is debounced,onChange
has a new signature:
type validation = { valid: boolean, fieldErrors: any, errors: any[] }
type onChange = (fieldValues: any, validation?: validation) => void
- Dynamic inputs: Errors will not propagate correctly for dynamically growing rows of dynamically growing inputs. This is a known bug.
undefined
values in serialization. If you don't provide avalue
ordefaultValue
(orchecked
/defaultChecked
) then serializing the form with unchanged inputs now returnsundefined
s instead of empty strings. For validation, we default this to an empty string. This could prove an issue if you have custom inputs with built in default values which don't get passed down as props.
Release 0.7.1
Release 0.7
A bugfix release, bumping the minor version to fix some versioning issues.
See PR #69 for more details