Skip to content

Custom classes #8

@cbichis

Description

@cbichis

Hi,

One issue I noticed with the library is I cant add also some custom css classes directly when adding the form element.

    $this->addElement('text', 'date', array(
        'attribs' => [
            'onchange' => 'this.form.submit()',
            'class' => 'datepicker',
            'size' => 10,
            'maxlength' => 10,
        ],
        'value' => date('Y-m-d')
    ));

The class is overwrited by form-control.

I can append additional classes only after the form element is added.

    $class = $this->getElement('date')->getAttrib('class');
    $this->getElement('date')->setAttrib('class', $class.' datepicker');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions