Novi
How do I add custom JavaScript to a form?
I am using the ColorPicker component and I want to change the SVG prefix icon color with JavaScript so it reflects whatever color has been chosen in real time. However I can't figure out how to get the JavaScript on to the page when it renders.
I've asked copilot and gone around the houses looking at getScripts and getFooterScripts in the edit page resource neither of which viewing the source appear to be doing anything.
Would really appreciate some advice, you'd be really helping me out.
7 replies
Table TextColumn of a toggle how to display Enabled / Disabled instead of 1 / 0?
Hi, as the title says really, I have a column that is stored as a simple 1 / 0 in the DB, but I need it to display to the viewer as Enabled / Disabled. My code looks like this:
Tables\Columns\TextColumn::make('enable_live')
->badge()
->color(fn (string $state): string => match ($state) {
'0' => 'gray',
'1' => 'success',
})
->sortable(),
I've read through the documentation and I've Googled extensively but I can't figure it out. Can anyone point me in the right direction?
4 replies