F
Filament15mo 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
awcodes15mo ago
Can you share the code for your TextInput?
Thijmen
ThijmenOP15mo ago
V2 or V3?
awcodes
awcodes15mo ago
V3. Just need to see what you’re actually trying to do.
Thijmen
ThijmenOP15mo 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
awcodes15mo 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
awcodes15mo ago
Mask — Alpine.js
Automatically format text fields as users type
Thijmen
ThijmenOP15mo 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
awcodes15mo ago
Look at the alpine doc. You can probably achieve it with the $money directive even if it isn’t actually money.
Want results from more Discord servers?
Add your server