How can I get typed value from TextInput with Mask?

I have the following code and would like to get a typed value but : symbol gets missing right now.
...Arr::map(['opening_hour', 'closing_hour'], fn ($name) => Forms\Components\TextInput::make($name)
->mask(fn (Forms\Components\TextInput\Mask $mask) => $mask
->patternBlocks([
'h' => fn (Forms\Components\TextInput\Mask $mask) => $mask
->range()
->from(0)
->to(23)
->maxValue(23)
->maxLength(2),

'm' => fn (Forms\Components\TextInput\Mask $mask) => $mask
->range()
->from(0)
->to(59)
->maxValue(59)
->maxLength(2),
])
->pattern('00:00')
)
->disableLabel()
...Arr::map(['opening_hour', 'closing_hour'], fn ($name) => Forms\Components\TextInput::make($name)
->mask(fn (Forms\Components\TextInput\Mask $mask) => $mask
->patternBlocks([
'h' => fn (Forms\Components\TextInput\Mask $mask) => $mask
->range()
->from(0)
->to(23)
->maxValue(23)
->maxLength(2),

'm' => fn (Forms\Components\TextInput\Mask $mask) => $mask
->range()
->from(0)
->to(59)
->maxValue(59)
->maxLength(2),
])
->pattern('00:00')
)
->disableLabel()
1 Reply
Patrick Boivin
I'm not sure there's a way to have the symbols included in the final value with masks... You can add them back before saving with dehydrateStateUsing()

Did you find this page helpful?