twill icon indicating copy to clipboard operation
twill copied to clipboard

Checkboxes not working

Open Cybearnaut opened this issue 9 months ago • 1 comments

Description

I am new to Twill CMS, I am not sure i did not configure things properly or what. My Checkboxes is not clickable, whenever i click it, it shows an error in the console.

Image Image

I am not sure does it related to Migration files or Model or what, because i haven't setup any columns/fields on that yet, but a JS error looks like frontend-only issue to me

Steps to reproduce

  1. Add the checkboxes field
<x-twill::checkboxes name="external_links" label="External Links" :options="[
            ['value' => 'website', 'label' => 'Website'],
            ['value' => 'facebook', 'label' => 'Facebook'],
            ['value' => 'instagram', 'label' => 'Instagram'],
            ['value' => 'other', 'label' => 'Other'],
]" />

I have also tried this in the controller, same issue

             Checkboxes::make()
                    ->default([])
                    ->name('external_links')
                    ->label('External Links')
                    ->options([
                        ['value' => 'website', 'label' => 'Website'],
                        ['value' => 'facebook', 'label' => 'Facebook'],
                        ['value' => 'instagram', 'label' => 'Instagram'],
                        ['value' => 'other', 'label' => 'Other'],
                    ]),
  1. Click on the checkbox, boom, nothing happens but an error in console

Versions

Twill version: 3.5.2 Laravel version: 11.44.2 PHP version: 8.2 Database engine: MySQL

Cybearnaut avatar Apr 09 '25 05:04 Cybearnaut

This shouldn't possibly happen

https://github.com/area17/twill/blob/5ad223769424986ae4ff7db727fcba3bdfe5296c/frontend/js/components/MultiSelect.vue#L91-L96

You don't happen to have a script that modifies Array.prototype.slice ?

Edit: forgot that String also has the slice method, which is why that didn't trigger an error

Tofandel avatar Apr 09 '25 06:04 Tofandel