forms icon indicating copy to clipboard operation
forms copied to clipboard

Cannot add attributes to Checkbox

Open jrslv opened this issue 9 years ago • 1 comments

It is currently not possible to add HTML attributes to checkboxes using {input foo, 'class' => 'bar'} Latte macro. The reason is getControl method of Checkbox returns a wrapper HTML object instead of the input itself.

Rewriting getControl method to

public function getControl()
{
    $this->wrapper = $this->getLabelPart()->insert(0, $this->getControlPart());
    return $this->wrapper;
}

at least fixes the ability to add attributes to the wrapper element (maybe this is disabled on purpose to avoid confusion). But anyway adding attributes to checkbox input elements is not currently possible.

jrslv avatar Jul 13 '16 21:07 jrslv

Better way is to use <input n:name=foo class=bar>

dg avatar Jun 21 '17 08:06 dg