winter icon indicating copy to clipboard operation
winter copied to clipboard

[FIX] Fix checkboxlist not showing options when in preview / disabled

Open jaxwilko opened this issue 3 years ago • 4 comments

Previously, the condition elseif (!$readOnly && count($fieldOptions)) would prevent valid options being rendered when the $readOnly var is true ($readOnly = $this->previewMode || $field->readOnly || $field->disabled;).

This seems to be incorrect, the correct approach should be to show all options but mark them all as disabled.

This changes:

image

To:

image

jaxwilko avatar Nov 04 '22 12:11 jaxwilko

Hmm, might be a bit of a subjective call, but I personally would prefer it to hide options that aren't selected when in preview mode, especially if it's a long checkbox list.

Would your changes also make this condition block redundant?

bennothommo avatar Nov 06 '22 03:11 bennothommo

@bennothommo our specific use case is showing a preview of the field in a visual formbuilder so we would want all options to be displayed.

LukeTowers avatar Nov 06 '22 19:11 LukeTowers

This pull request will be closed and archived in 3 days, as there has been no activity in this pull request for the last 6 months. If you intend to continue working on this pull request, please respond within 3 days. If this pull request is critical for your business, please reach out to us at [email protected].

github-actions[bot] avatar May 08 '23 00:05 github-actions[bot]

My preference is still the same, but perhaps the preview state can be configurable? (ie. showOnPreview: all|checked|unchecked)

bennothommo avatar May 09 '23 00:05 bennothommo

Whats the status on this @jaxwilko @bennothommo?

LukeTowers avatar Apr 25 '24 23:04 LukeTowers

As indicated before, I still have the same preference.

bennothommo avatar Apr 26 '24 01:04 bennothommo

If nobody is asking for it now maybe we just close it and revisit in the future if there is demand.

From my side of things, I still reckon the most user friendly way to do it would be to show all options but have each input marked as disabled as then people with only preview permission would be able to see all options avaliable even if they could not interact with any of them. Not massively opposed to showOnPreview, but it adds more complexity to an already complex system which may not be preferable.

jaxwilko avatar Apr 26 '24 09:04 jaxwilko

I'm fine with merging this and if it becomes a problem in the future that too many options are shown on the preview screen then a hideWhenReadonly or similar option can be added at that point.

LukeTowers avatar Apr 27 '24 14:04 LukeTowers