currency mask?

I have an input like this:
TextInput::make('amount')
->label('Import')
->mask(fn(Mask $mask) => $mask
->patternBlocks([
'money' => fn(Mask $mask) => $mask
->numeric()
->decimalPlaces(2)
->thousandsSeparator('.')
->decimalSeparator(','),
])
->pattern('money€')),
TextInput::make('amount')
->label('Import')
->mask(fn(Mask $mask) => $mask
->patternBlocks([
'money' => fn(Mask $mask) => $mask
->numeric()
->decimalPlaces(2)
->thousandsSeparator('.')
->decimalSeparator(','),
])
->pattern('money€')),
At first it shows the '€' symbol, and after trying to add a prohibitted char(like space or a letter) it shows too. But I want to show the symbol always, I mean, while I was typing.
Solution:
I don't want to use a suffix... finally I opted by using a custom field with autonumeric.
Jump to solution
3 Replies
Tieme
Tieme5mo ago
You can use prefix / suffix icon on the text field. See documentation for how to use it. https://filamentphp.com/docs/3.x/forms/fields/text-input#adding-affix-text-aside-the-field
Solution
tesse05
tesse055mo ago
I don't want to use a suffix... finally I opted by using a custom field with autonumeric.
tesse05
tesse055mo ago
final version: