01493: unwanted whitespace in forms between html tags

Summary: unwanted whitespace in forms between html tags
Created: 2023-09-06 10:52
Status: Open
Category: Feature
From: tictactux
Assigned:
Priority: 1
Version: 2.3.25
OS: (any)

Description: when using a form with (:input checkbox CheckBoxName "some label to go with the checkbox":), pmwiki adds a blank between the "<input ...>" and the "<label for >" elements. This causes unwanted layout issues.

The culprit is scripts/forms.php line 181:
$FmtV['$InputFormLabel'] = " <label for=\"{$opt['id']}\"$lbtitle>{$opt['label']}</label> ";

if we modify it to
$FmtV['$InputFormLabel'] = "<label for=\"{$opt['id']}\"$lbtitle>{$opt['label']}</label>";
(i.e. trim($FmtV['$InputFormLabel']) all is well.

Is there a specific reason to have blanks in there, or...? tictactux

The specific reason is that we want to have a space at that place, as in, we want the label text not glued to the checkbox or to the text following it. We can make the label snippet configurable, so you could set it without the space(s). --Petko

You can try the pre-release from ChangeLog (only scripts/forms.php changed) and set this to config.php:

$InputLabelFmt = '<label for="$LabelFor" $LabelTitle>$LabelText</label>';

Let me know if this works and if you need anything else. --Petko