Skip to content

Textarea element cols and rows #675

Closed
@tzyganu

Description

@tzyganu

The values for textarea admin form elements are added after calling the parent constructor.
This means that if I add an element in the admin form and specify the cols or rows they will be ignored.

$fieldset->addField('some_name', 'textarea', array(
        'name'      => 'some_name',
        'label'     => __('Some Label'),
        'title'     => __('Some Label'),
       'rows' => 10,
       'cols' => 40
    ));

I end up with

<textarea data-ui-id="....-fieldset-element-textarea-some-name" class=" textarea" cols="15" rows="2" title="Some Label" name="some_name" id="some_name"></textarea>

In order to change the cols and rows I need to get the element from the fieldset and set the cols and rows.
I think the setters in the constructor should be wrapped in an if statement. This should solve the issue.

if (!$this->getRows()) {
   $this->setRows(2);
}
if (!$this->getCols()) {
    $this->setCols(15);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentimprovement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions