You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please specify what version of the library you are using: [ v3.15 ]
Expected / Desired Behavior / Question
I've identified two issues:
Firstly, number validation added in 8998b5d seems to have broken form validation where:
a numeric list field is set as not required
that numeric list field has a minimum and maximum value set
the user chooses not to enter a value, or enters a value then deletes it
I had a some lists where fields had minimum and maximum values between 1 and 5 - and they all stopped working in DynamicForm after recently updating the library in one of my projects.
Secondly, the validation added does not yet work for Currency fields.
Observed Behavior
The form silently fails to save if the user leaves the field blank. The reason this happens is because the check in DynamicForm.tsx sets shouldBeReturnBack to true if val.newValue < val.minimumValue. If the user leaves a field empty, val.newValue is an empty string "" - which is falsey, and equivalent to zero. So if the minimum value is, for example, 1 - then shouldBeReturnBack is set to true, and the form doesn't save. For a list where the field is not required, this is incorrect behaviour. In DynamicField.tsx the logic that determines the error to display DOES check the length of the string value first, and so - no error is returned to tell the user why the form didn't save.
Steps to Reproduce
Add a number column to a list
Set the minimum and maximum values to 1 and 5 respectively.
Using DynamicForm, enter and then delete a value from this field and attempt to save a form while this value is blank.
For the currency issue, observe that validation added in the referenced commit does not also work for those fields.
I have a PR ready to go for the above.
The text was updated successfully, but these errors were encountered:
Category
[ ] Enhancement
[x ] Bug
[ ] Question
Version
Please specify what version of the library you are using: [ v3.15 ]
Expected / Desired Behavior / Question
I've identified two issues:
Firstly, number validation added in 8998b5d seems to have broken form validation where:
I had a some lists where fields had minimum and maximum values between 1 and 5 - and they all stopped working in DynamicForm after recently updating the library in one of my projects.
Secondly, the validation added does not yet work for Currency fields.
Observed Behavior
The form silently fails to save if the user leaves the field blank. The reason this happens is because the check in
DynamicForm.tsx
setsshouldBeReturnBack
to true ifval.newValue < val.minimumValue
. If the user leaves a field empty,val.newValue
is an empty string""
- which is falsey, and equivalent to zero. So if the minimum value is, for example, 1 - thenshouldBeReturnBack
is set to true, and the form doesn't save. For a list where the field is not required, this is incorrect behaviour. InDynamicField.tsx
the logic that determines the error to display DOES check the length of the string value first, and so - no error is returned to tell the user why the form didn't save.Steps to Reproduce
For the currency issue, observe that validation added in the referenced commit does not also work for those fields.
I have a PR ready to go for the above.
The text was updated successfully, but these errors were encountered: