Why HtmlString not work in filamentphp

->afterStateUpdated(function ($state, callable $set, callable $get) { self::updateRiskRates($state, $set, $get); $value = RiskManagementRiskCalculationValue::whereIn('selectedTab', ['addition', 'multiplication'])->first(); if ($value) { if ($value->selectedTab === 'addition') { $inherentRiskRate = $get('likelihood') + $get('impact'); $htmlContent = new HtmlString('<div>Addition Calculation</div>') . $get('likelihood') . ' + ' . $get('impact') . ' = ' . $inherentRiskRate; $set('culation', $htmlContent); } elseif ($value->selectedTab === 'multiplication') { $inherentRiskRate = $get('likelihood') * $get('impact'); $htmlContent = new HtmlString('<div>Multiplication Calculation</div>') . $get('likelihood') . ' * ' . $get('impact') . ' = ' . $inherentRiskRate; $set('culation', $htmlContent); } } })
No description
Solution:
You shouldn't $set an HtmlString. It probably should be formatted when output
Jump to solution
8 Replies
LeandroFerreira
LeandroFerreira3mo ago
what isn't working?
Alnuaimi
Alnuaimi3mo ago
new HtmlString('<div>Addition Calculation</div>')
No description
LeandroFerreira
LeandroFerreira3mo ago
Is it a placeholder?
Alnuaimi
Alnuaimi3mo ago
no custom filed <x-dynamic-component :component="$getFieldWrapperView()" :field="$field" > <div x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }" class="label label-striped label-custom-alert {{ App::getLocale() === 'ar' ? 'bordermatrixr' : 'border-left-danger-matrix' }}"> <span x-text="state"></span> </div> </x-dynamic-component>
LeandroFerreira
LeandroFerreira3mo ago
use x-htmlinstead of x-text
ericmp
ericmp3mo ago
@Alnuaimi
No description
Solution
Dennis Koch
Dennis Koch3mo ago
You shouldn't $set an HtmlString. It probably should be formatted when output
Alnuaimi
Alnuaimi2mo ago
thanks ,It's working now
Want results from more Discord servers?
Add your server