TextInputColumn (date) submit too fast

Hi all 👋 I have a resource with an “expiry date” table. To go faster, I wanted to add a TextInputColumn to my table so that I could just change the date without having to go through a modal or an edit page. So I did the following:
Tables\Columns\TextInputColumn::make('expiration_date')
->label('Expiration date')
->placeholder('-')
->type('date')
->toggleable()
->rules(['nullable', 'date'])
->sortable(),
Tables\Columns\TextInputColumn::make('expiration_date')
->label('Expiration date')
->placeholder('-')
->type('date')
->toggleable()
->rules(['nullable', 'date'])
->sortable(),
It works, on my table I now have a text field with a calendar available. The problem is that as soon as I start to change a date (if I type a number in the field, for example, or select a day in the calendar) the value is updated directly in the DB, which is a bit annoying because I haven't necessarily finished editing (let's say I want to type day 20, the value is updated as soon as I type 2). Is there a method I can add to avoid this? Thanks in advance.
5 Replies
Gianne
Gianne2mo ago
Same here... do you have some solution for this?
awcodes
awcodes2mo ago
Try ->live(onBlur: true)
Gianne
Gianne2mo ago
I don't have this ->live() method on Table Columns 😦
awcodes
awcodes2mo ago
Hmm, would have expected it too, you might have to use ->native(false) then, but you’ll loose the ability to type in the date.
Gianne
Gianne2mo ago
That's true. Maybe they let the field only update date after onBlur in next versions. This is really annoying. I'll try to change this data using a modal. Thanks for your help!
Want results from more Discord servers?
Add your server