revolution icon indicating copy to clipboard operation
revolution copied to clipboard

View values in TV listbox-multiple then it manually entered

Open Alexij2 opened this issue 3 years ago • 3 comments

What does it do?

  • Displays values manually entered by the manager in the admin panel. For MODX 2.x

Why is it needed?

  • It is necessary to fix the display problem. #15136 (it for MODX 3.x, but for 2.x acutally too)

How to test

  • Created TV listbox-multiple add to template
  • Open resource and type in this TV manually some words. -> press Enter -> Save Document.
  • Reload page (F5), Open TV and see changes. Describe how to test the changes you made.

Related issue(s)/PR(s)

#15136

Alexij2 avatar Aug 07 '22 14:08 Alexij2

Thanks for helping to make MODX better. This fix should check, wether the TV option forceSelection is deactivated and not add the unsupported values then. Otherwise the patch looks ok.

What happens if an unsupported value is in the TV and the TV is saved?

Jako avatar Aug 07 '22 23:08 Jako

I just put up a PR to fix this in 3.x. Take a look (see #16242), as it may inform how you approach this. I believe the un-patched file is virtually the same for 2.x and 3.x, so you may be able to use what I've done if you like. The one thing I see (that would need fixing) is that you probably end up duplicating selected values in the list when they are among the pre-defined input options values.

smg6511 avatar Aug 08 '22 04:08 smg6511

What happens if an unsupported value is in the TV and the TV is saved?

It is stored normally. It is not duplicated in the Database. Also, there is no duplication of the value, JS does not allow this to be done in the admin panel. And even if it is possible to write the value, then after saving and when updating the page (F5), the data is displayed correctly.

The one thing I see (that would need fixing) is that you probably end up duplicating selected values in the list when they are among the pre-defined input options values.

Duplication of the value does not occur. Js does not allow this to be done in the admin panel. I also thought that it would be duplicated, but as practice has shown, this does not happen, because unique values come to be recorded in the field DB.

Alexij2 avatar Aug 08 '22 07:08 Alexij2