F
Filament15mo ago
Stevee

thousandsSeparator mask for v3

in v2 can do
TextInput::make('number')
->numeric()
->mask(fn (TextInput\Mask $mask) => $mask
->numeric()
->decimalPlaces(2) // Set the number of digits after the decimal point.
->decimalSeparator(',') // Add a separator for decimal numbers.
->integer() // Disallow decimal numbers.
->mapToDecimalSeparator([',']) // Map additional characters to the decimal separator.
->minValue(1) // Set the minimum value that the number can be.
->maxValue(100) // Set the maximum value that the number can be.
->normalizeZeros() // Append or remove zeros at the end of the number.
->padFractionalZeros() // Pad zeros at the end of the number to always maintain the maximum number of decimal places.
->thousandsSeparator(','), // Add a separator for thousands.
)
TextInput::make('number')
->numeric()
->mask(fn (TextInput\Mask $mask) => $mask
->numeric()
->decimalPlaces(2) // Set the number of digits after the decimal point.
->decimalSeparator(',') // Add a separator for decimal numbers.
->integer() // Disallow decimal numbers.
->mapToDecimalSeparator([',']) // Map additional characters to the decimal separator.
->minValue(1) // Set the minimum value that the number can be.
->maxValue(100) // Set the maximum value that the number can be.
->normalizeZeros() // Append or remove zeros at the end of the number.
->padFractionalZeros() // Pad zeros at the end of the number to always maintain the maximum number of decimal places.
->thousandsSeparator(','), // Add a separator for thousands.
)
what is the alternative for v3 ?
4 Replies
ariaieboy
ariaieboy14mo ago
I have the same question @Dan Harrin Since the alpinejs mask change the value of the input the masked number send back to backend and all integer and number validation will stop working if we use tha money mask.
Stevee
Stevee13mo ago
just find out, this happend on chrome but not on firefox
Andrew Wallo
Andrew Wallo13mo ago
Yeah. There is an issue on GitHub already. But I suggest to just transform the string value back to an integer using a cast.
Want results from more Discord servers?
Add your server