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