-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FORMS] Invalid form causes NumericField with localised number format to be populated in wrong format after validation #6910
Comments
see #6911 for fix |
That was fast :-) Thanks a lot, I added some comments to #6911 |
We could fix this by making the session errors data array hold the submitted value, rather than the data value. It needs a bit more investigation. |
I notice a related problem when i'm trying to add |
Changing to impact medium (we have a lot of international uses of Silverstripe out there). |
Closed in favour of #10626 |
If a form validation fails, the form is populated with the submitted values. The submitted values are determined by calling the getData method. This method iterates over all data fields and determines their value by calling dataValue. The NumericField returns as dataValue the normalised format of its value (e.g. '4.2'). The type of the returned value is a string (as defined in the PHPDocs). When loading this value into the form in setupFormErrors, the setValue method in NumericField gets passed the normalised value as string as well as the array of all submitted data. As the value is neither of type int or float, nor is the data passed as second argument a DataObject, the non localised value is set. This results in NumericFields, where all values are non localised. Saving the form again results in a form validation error, as the non-localised values are not valid.
This is a 3.5.x issue.
The text was updated successfully, but these errors were encountered: