Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting button ID via chainable method is ignored #113

Open
gavinsbtm opened this issue Nov 10, 2021 · 0 comments
Open

Setting button ID via chainable method is ignored #113

gavinsbtm opened this issue Nov 10, 2021 · 0 comments

Comments

@gavinsbtm
Copy link

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>';
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant