Skip to content

Setting button ID via chainable method is ignored #113

Open
@gavinsbtm

Description

@gavinsbtm

Adding an ID to a button element using chainable id method is ignored.

Eg: Form::button('Upload')->id('upload-btn')

Output is: <button type="button" class="btn btn-primary">Upload</button>

Expected output: <button id="upload-btn" type="button" class="btn btn-primary">Upload</button>

Changing renderButton() function in FormBuilder.php fixes this:

private function renderButton(): string
    {
        extract($this->get('id', 'type', 'value', 'disabled'));
        $class = $this->getBtnAnchorClasses();
        $attrs = $this->buildHtmlAttrs(['id' => $id, 'type' => $type, 'class' => $class, 'disabled' => $disabled]);
        return '<button ' . $attrs . '>' . $value . '</button>';
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions