F
Filament5mo ago
blink

Form builder does not allow decimals. (?)

Neither dot or comma is accepted - chrome@mac Any solution?
TextInput::make('salary_from')
->numeric(),

TextInput::make('salary_to')
->numeric(),
TextInput::make('salary_from')
->numeric(),

TextInput::make('salary_to')
->numeric(),
No description
16 Replies
Vp
Vp5mo ago
can you provide all code for TextInput
blink
blinkOP5mo ago
Here is the whole resource file Migration $table->decimal('salary_from', 10, 2); $table->decimal('salary_to', 10, 2);
blink
blinkOP5mo ago
What do you mean exactly? Sould I add min-max validation to enable decimals?
Vp
Vp5mo ago
ah wait.. it's because of numeric see here https://www.php.net/manual/en/function.is-numeric.php More here https://laravel.com/docs/11.x/validation#rule-numeric I may be wrong tho.. 🤣
blink
blinkOP5mo ago
I've seen docs, filamnet suggests using ->numeric() for numeric fields, my problem is not being able to save decimals I dont think you got me
blink
blinkOP5mo ago
Same - input mode is 'decimal' by default when using ->numeric()
Vp
Vp5mo ago
Just check and it's working fine Forms\Components\TextInput::make('order')->numeric(),
No description
blink
blinkOP5mo ago
i see u dd() something does it acrtually work? not returning validation error?
Vp
Vp5mo ago
Actually my database is not setup to support decimal let me experiment with string type
Vp
Vp5mo ago
Working fine
Vp
Vp5mo ago
I don't have any idea in your case.. sorry
toeknee
toeknee5mo ago
Can we see your model too? Decimals are supported.
blink
blinkOP4mo ago
Nothing custom in model class, decimal(10,2) column. I decided to use text input with masking.

Did you find this page helpful?