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
LeandroFerreira5mo ago
what isn't working?
Alnuaimi
AlnuaimiOP5mo ago
new HtmlString('<div>Addition Calculation</div>')
No description
LeandroFerreira
LeandroFerreira5mo ago
Is it a placeholder?
Alnuaimi
AlnuaimiOP5mo 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
LeandroFerreira5mo ago
use x-htmlinstead of x-text
ericmp
ericmp5mo ago
@Alnuaimi
No description
Solution
Dennis Koch
Dennis Koch5mo ago
You shouldn't $set an HtmlString. It probably should be formatted when output
Alnuaimi
AlnuaimiOP5mo ago
thanks ,It's working now
Want results from more Discord servers?
Add your server