F
Filamentβ€’2mo ago
at1220

I uses have a problem v4 when use mask

i have a text input like this TextInput::make('base_price') ->label('πŸ’° Price') ->mask(RawJs::make('$money($input)')) ->stripCharacters(',') ->numeric() ->suffix('Δ‘') ->minValue(1000) ->required() ->live(onBlur: true) ->afterStateUpdated(fn(callable $set, callable $get) => updateOrderForm($set, $get)), the value in have when input 10000000 is 1 All digits after the decimal point are removed. how to fix this. The updateOrderForm function is used to calculate the total, but the calculation is incorrect because the values inside the function are wrong.
No description
1 Reply
Daniel
Danielβ€’2mo ago
Follow up, I have the same issue. My current solution is using this package (https://filamentphp.com/plugins/ariaieboy-currency). So in your case, it would be TextInput::make('base_price') ->label('πŸ’° Price') ->currencyMask(thousandSeparator: ',',decimalSeparator: '.',precision: 2) ->numeric() ->suffix('Δ‘') ->minValue(1000) ->required() ->live(onBlur: true) ->afterStateUpdated(fn(callable $set, callable $get) => updateOrderForm($set, $get)),

Did you find this page helpful?