ui icon indicating copy to clipboard operation
ui copied to clipboard

Multiline must use regular UI/PHP controls

Open PhilippGrashoff opened this issue 6 years ago • 3 comments

Hi, I am using multiline with containsMany, and thats just a great combination! Using a money field, I noticed two things in this combination:

  1. In normal Form Fields, Money fields do get rendered with number_format, always displaying 2 digits after the dot (e.g. 25.90). This currently does not happen in multiline. It seems that Persistence\UI in not involved for rendering field values.
  2. When saving the data, the typecasting/normalization that takes place in normal form fields does not seem to happen. When I save a normal money field with an input like 25,90 (notice the comma as separator), this is saved as 259 in persistence. With Multiline and containsMany, the original value 25,90 is saved in the json encoded data.

I think its important to have Multiline form fields to behave as much as possible like normal form fields (which won't always be 100% possible as a different JS library is used for multiline fields). But these cases are Server Side only and shouldn't be too hard to implement. Making sure that data "flow" is the same for each form field (whether its a normal form field or a multiline field) will prevent some bad surprises :)

And: Many thanks for all the work you put in there Alain!

PhilippGrashoff avatar Oct 05 '19 17:10 PhilippGrashoff

These suggestions seem pretty logical and I agree.

acicovic avatar Oct 06 '19 19:10 acicovic

As I mentioned to @ibelar and @romaninsh quite some time ago in Slack about Multiline - it should use same FormField decorators as a Form class uses. Only that way we can show any type of form field inside Multiline component without even worrying how it will look and act in there. Like DropDown, Lookup, Checkbox, DateTime and so on.

DarkSide666 avatar Oct 15 '19 20:10 DarkSide666

@DarkSide666 I completely agree. Implementation-wise I don't know how easy this would be. Someone who has more experience with that aspect could perhaps give their opinion.

acicovic avatar Nov 15 '19 17:11 acicovic

Currently multiline lookup is buggy, like in demo demos/form-control/multiline.php:

image

it opens with options defined in the items data instead of the source data, something must be written to fetch the data from API first

mvorisek avatar Oct 14 '22 10:10 mvorisek