verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
93 stars 69 forks source link

Show the disabled option in a radio field #1816

Open carolineboeykens opened 2 months ago

carolineboeykens commented 2 months ago

What are you trying to do?

We have the choice to disable an option in a radio field: image

This is very nice, but in the HTML the option is not added. We would like to still show the option but make it not clickable (the very meaning of disabled)

What's your proposed solution?

In this code:

foreach ($this->options as $option) {
  $disabled = $option['disabled'] ?? false;

   if (!$disabled) {
     $options[] = $option;
   }
}

We would still add the option, but add the disabled="true" to the HTML option.

Additional context

No response

engram-design commented 2 months ago

This setting was introduced in https://github.com/verbb/formie/issues/824 and is more for disabling the option from being rendered altogether. This is mainly to help with data consistency. If you remove an option from a field, it means that submissions will no longer show that value, as it's technically invalid.

So there's two different things we want, to have it enabled (actually rendered), and disabled (shown visually with disabled attribute on the HTML element).

I'd rather not introduce another checkbox to this table to confuse people further and add visual clutter. I'll consider what to do on this point.