F
Filament10mo ago
Thijmen

Thousand separator and decimal separator

Is there any way in V3 to get the thousandSeparator and decimalSeparator on a TextInput? Or is there a new way?
8 Replies
awcodes
awcodes10mo ago
Can you share the code for your TextInput?
Thijmen
Thijmen10mo ago
V2 or V3?
awcodes
awcodes10mo ago
V3. Just need to see what you’re actually trying to do.
Thijmen
Thijmen10mo ago
Don't have any mask in V3 right now. Because not sure what to way is to achieve it in V3 V2 code was this:
->mask(
fn (TextInput\Mask $mask) => $mask
->patternBlocks([
'money' => fn (Mask $mask) => $mask
->numeric()
->thousandsSeparator('.')
->decimalSeparator(','),

])
->pattern('$ money'),
)
->mask(
fn (TextInput\Mask $mask) => $mask
->patternBlocks([
'money' => fn (Mask $mask) => $mask
->numeric()
->thousandsSeparator('.')
->decimalSeparator(','),

])
->pattern('$ money'),
)
awcodes
awcodes10mo ago
Ahh. Ok. V3 uses the alpine mask so there is no class to call those methods on. https://filamentphp.com/docs/3.x/forms/fields/text-input#input-masking
awcodes
awcodes10mo ago
Mask — Alpine.js
Automatically format text fields as users type
Thijmen
Thijmen10mo ago
Yeah saw that. Just not sure how to make it with rawjs but will figure something out if that is the only way
awcodes
awcodes10mo ago
Look at the alpine doc. You can probably achieve it with the $money directive even if it isn’t actually money.