Support » Plugin: Form Manager » [Plugin: WordPress Form Manager] label tags around checkbox list items (patch)

  • The labels within a checkbox list are currently (as of WP FM 1.6.35) placed right after the corresponding <input> elements as blank text nodes. This makes it rather inconvenient to access them through CSS or JS.
    I suggest to enclose them in HTML <label> tags, according to the following scheme:

    <input type="checkbox" id="custom_list-xxxx"><label for="custom_list-xxxx">Label associated with checkbox</label>

    Here’s a patch to be applied to wordpress-form-manager/formelements/formelements.php:

    --- formelements.php	2012-05-25 17:42:51.000000000 +0200
    +++ formelements.modified.php	2012-05-25 17:57:56.571064600 +0200
    @@ -90,7 +90,7 @@
     	if(!(isset($elementDef['options']) && is_array($elementDef['options']))) return "";
     	foreach($elementDef['options'] as $k=>$v){
    -		$arr[] = "<input type=\"checkbox\" ".fe_getAttributeString($elementDef['attributes'])." id=\"".htmlspecialchars($k)."\" name=\"".htmlspecialchars($k)."\" ".($vals[$k]?'checked':'')."/>  ".htmlspecialchars($v)."";
    +		$arr[] = "<input type=\"checkbox\" ".fe_getAttributeString($elementDef['attributes'])." id=\"".htmlspecialchars($k)."\" name=\"".htmlspecialchars($k)."\" ".($vals[$k]?'checked':'')."/><label for=\"".htmlspecialchars($k)."\">".htmlspecialchars($v)."</label>";
     	$str = implode($elementDef['separator'],$arr);
     	return $str;

  • The topic ‘[Plugin: WordPress Form Manager] label tags around checkbox list items (patch)’ is closed to new replies.