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.
7 Replies
Gianne
Gianne3mo ago
Same here... do you have some solution for this?
awcodes
awcodes3mo ago
Try ->live(onBlur: true)
Gianne
Gianne3mo ago
I don't have this ->live() method on Table Columns 😦
awcodes
awcodes3mo 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
Gianne3mo 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!
ddoddsr
ddoddsr2mo ago
Did you find an inline solution or did you make a modal? I'd like to see how you did a model datepicker.
Gianne
Gianne2mo ago
For now, do I change to a text type. In my case it's for admin propurses, and who manages, can use as text woth no problem.
Want results from more Discord servers?
Add your server