Webform 3 has this option on its fields and its really useful.

[x] Hide component title
Do not display the title or label of this field in the form.

It would be great to get this option into this module too.

Comments

mrfelton’s picture

Status: Active » Needs work
StatusFileSize
new1.06 KB

The attached patch allows you to form_alter the title out successfully. Without this, even if you unset #title through a form_alter, the colon (:) still displays before the field.

Obviously what we also need though is an option in the UI to allow hiding of the title, rather than making people use form_alter to do it.

megachriz’s picture

Interesting request. I will think about it, but if I remember well, I had some issues with getting rid of a colon in the delivery/billing panes before, so I'm not sure if it is possible to remove a field label (including the colon) in these panes without overriding the theme function defined in Ubercart. If this is the case, then it will not make much sense to add this feature if it doesn't work with the address panes. (I've not tested it yet, maybe it will just work fine!)

Can you tell me what your use case is for this feature?

If it has something to do with the checkboxes, panthar is currently implementing these now, but we have decided to support a single checkbox only per field (instead of having multiple checkboxes per field). This is also the case in the core profile module. Discussing checkboxes can be done here: #1008138: Fix checkboxes field type

mrfelton’s picture

My use case is that my client wants their form to look a particular way. They want a collapsable fieldset, which has a title of 'Reason for donating today'. This fieldset has only one form element in it - a select dropdown with various options like 'Heard about it on the radio', 'saw a tv advert' etc. Now since the fieldset is titled with the name of the question, it makes no sence whatsoever to have the select also have a title.

LIKE THIS:

- Reason for donating today ---------------------
|  [SELECT ELEMENT]                            |
-------------------------------------------------

NOT:

- Reason for donating today ---------------------
|  Reason for donating today: [SELECT ELEMENT]  |
-------------------------------------------------
megachriz’s picture

Hi mrfelton,

I was a little busy last week, so I didn't had enough time to respond earlier. Sorry for that.

I have looked at Ubercart's code to see if it's possible to have an empty field title for an address field (in the delivery/billing panes) without a semicolon to be shown and without altering Ubercart code, but I found out this isn't possible unless I copy the whole theme function 'theme_address_pane' to Extra Fields Pane and tell Drupal via a hook_form_alter() it should use that theme function instead.
Check line 452 of uc_cart_checkout_pane.inc to see why an empty field title can not be used without overwriting the theme function:$title = $form[$field]['#title'] .':';

Maybe Extra Fields Pane should overwrite the theme_address_pane-function, because an empty 'label' might be useful for the checkbox fieldtype also. I'll think about it and will look at this again once the checkbox field type is fully implemented.

megachriz’s picture

Status: Needs work » Active

Patch in #1 is committed.

I think we should not support empty field labels, because the address panes provided by Ubercart do not support that (a colon would still be shown in those panes). The checkbox field type is fixed now, but it makes use of the label (when I posted my previous post I wasn't sure about that yet), so an empty label is not necessary useful for the checkbox field type anymore.

Opinions?

megachriz’s picture

Status: Active » Postponed

I postpone this feature request, as I have no intention to fix it because it will not work together well with Ubercart without overriding the theme function theme_address_pane(). I could also mark it as "won't fix", but I may reconsider adding this feature if there are more opinions or if someone posts a patch.