Commit a1049a62 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Use correct id in labels in pieform 'oneline' forms (bug #771154)

In forms using the 'oneline' renderer, label elements were being
generated with a 'for' attribute that didn't contain the correct
element id of the corresponding input element, so the field could
not be selected by clicking on the label.

It appears that at some point in the past, the label generation was
moved out of the renderers and into a function in core pieforms,
but I believe the oneline renderer was overlooked at this time, as
it is not using this generated label.

This patch removes the label html generation from the oneline
renderer, and replaces it with the label html generated by core

Change-Id: Ic607a7e169ffd8e874479c3683695ef86b06e7f0
Signed-off-by: default avatarRichard Mansfield <>
parent bc4cc476
......@@ -51,17 +51,8 @@ function pieform_renderer_oneline(Pieform $form, $element) {/*{{{*/
$result .= '>';
if (isset($element['title']) && $element['title'] !== '' && $element['type'] != 'fieldset') {
if (!empty($element['nolabel'])) {
// Don't bother with a label for the element
$result .= Pieform::hsc($element['title']);
else {
$result .= '<label for="' . $element['id'] . '">' . Pieform::hsc($element['title']) . '</label>';
if ($form->get_property('requiredmarker') && !empty($element['rules']['required'])) {
$result .= ' <span class="requiredmarker">*</span>';
if (isset($element['labelhtml'])) {
$result .= $element['labelhtml'];
$result .= $element['html'];
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment