forms
forms copied to clipboard
Cannot add attributes to Checkbox
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.
Better way is to use <input n:name=foo class=bar>