F
Filament2mo 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
Vp2mo ago
can you provide all code for TextInput
blink
blinkOP2mo ago
Here is the whole resource file Migration $table->decimal('salary_from', 10, 2); $table->decimal('salary_to', 10, 2);
blink
blinkOP2mo ago
What do you mean exactly? Sould I add min-max validation to enable decimals?
Vp
Vp2mo 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
blinkOP2mo 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
blinkOP2mo ago
Same - input mode is 'decimal' by default when using ->numeric()
Vp
Vp2mo ago
Just check and it's working fine Forms\Components\TextInput::make('order')->numeric(),
No description
blink
blinkOP2mo ago
i see u dd() something does it acrtually work? not returning validation error?
Vp
Vp2mo ago
Actually my database is not setup to support decimal let me experiment with string type
Vp
Vp2mo ago
Working fine
Vp
Vp2mo ago
I don't have any idea in your case.. sorry
toeknee
toeknee2mo ago
Can we see your model too? Decimals are supported.
blink
blinkOP2mo ago
Nothing custom in model class, decimal(10,2) column. I decided to use text input with masking.
Want results from more Discord servers?
Add your server