orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
511 stars 220 forks source link

`fr:dropdown-select1` to support minimal label #6333

Closed ebruchez closed 1 month ago

ebruchez commented 1 month ago

At first I was going to suggest that this is not possible. But we already show a "Please select:" placeholder item. We could style it to look a little different. This is now possible with CSS. We would need:

+1 from customer

See also #6318.

ebruchez commented 1 month ago

For this to work, the component must know whether there is a current placeholder. Solutions:

  1. xxf:is-minimal-label() or xxf:label-appearance()
  2. fr:keep-if-label-appearance="minimal"
ebruchez commented 1 month ago

The second solution would be best: the information is known statically. However, at the time we are processing the XBL template, we don't yet have LHHA information, which is attached to the controls at a later time. So we might have to resort to the first solution.

ebruchez commented 1 month ago
ebruchez commented 1 month ago

xxf:label-appearance() does the trick. In addition, we can use xxf:label() to obtain the value of the label and place it in the appropriate spot.

For the US Date field, and other fields, my idea was to use a nested fr:dropdown. In this case, however, while xxf:label-appearance() works, xxf:label() doesn't.

The reason is that xxf:label() only asks for a lhh label, and not for an lhhBy.

When a control evaluates its label, it uses MutableLHHProperty. This calls StaticLHHASupport.lhh(), which only includes direct LHH. So a control linked with lhhBY does not directly evaluate that LHH. This kind of makes sense, in that we don't want two controls to evaluate the same LHH. In addition, getLabel() on the control returns only the direct label.

When we output or update placeholders, we use a different logic, to find the concrete control linked, and get the label from it.

Two solutions:

  1. change the evaluation of labels to also use lhhBy
  2. change xxf:label() to obtain the label from the referencing control

Going with option 2.

ebruchez commented 1 month ago

Also added a demo form.