F
Filamentβ€’4mo ago
ericmp

How to make TextInput accept only 2 decimals

The price must only contain 2 decimals
Forms\Components\TextInput::make('price')
->numeric()
->inputMode('numeric')
->minValue(0.01)
->step(0.01)
->required()
->suffixIcon('heroicon-m-currency-euro')
,
Forms\Components\TextInput::make('price')
->numeric()
->inputMode('numeric')
->minValue(0.01)
->step(0.01)
->required()
->suffixIcon('heroicon-m-currency-euro')
,
But when i try it out, i can write several decimals. What i am missing?
No description
3 Replies
bwurtz999
bwurtz999β€’4mo ago
I'm not sure there is a way to limit the decimal places directly. You could use ->afterStateUpdated(function ($state, $set) and $set the value of the field to a rounded value
ericmp
ericmpβ€’4mo ago
like this works, but i want it to be formatted like this: 1.500,40 but i get: 1,500.40 i guess at the moment doesnt accept localisation or idk how to set it up now im trying this πŸ‘€
Want results from more Discord servers?
Add your server
More Posts
How to customize the label for options in CheckboxList?Right now I am getting the options for ChecboxList like: ```php CheckboxList::make('cars') ->optioRepeater set a Variable per FieldHello There I'm creating a Form with a Repeater Element. For each Field in that Repeater I need to Is there a way to disable the tenant registration?I am currently using the tenant methods on the admin panel, tenancy is working. I have a custom `->Unable to use TinyEditor Media ModalI have the problem that I cannot use the media modals on a current Filament V2 project (e.g. the hreThe POST method is not supported for route admin/login. Supported methods: GET, HEAD.login request method is POST. how i can change it ? when i see list of routes admin/login method is Using tab in custom pageHow can I use filter tab in livewire component? I saw this converstaion but got an error. https://giIs it possible to use queryStringIdentifier() for widgets with simple pagination?I'm using the `queryStringIdentifier()` for 2 widget table to resolve the pagination issue, but whenHow To Get data from form in login page into resource page or for query buildercan anyone help for this form ? how can i get the year data from this form to implement in all of myEquivalent of UpdateOrCreateHello, I want the createAction to check if a record already exists and then update it instead of creDetect image in FileUpload to hide upload instructionsI'm having trouble with changing the avatar after I upload it using the FileUpload field. Here's wha