How to get the clean state after using mask()?

By using afterStateUpdated, how to get the $state value as unmasked? Because In form when using $this->form->getState() the value gets cleaned.
TextInput::make('phone')
->placeholder('Phone Number')
->minLength(10)
->maxLength(14)
->afterStateUpdated(function (TextInput $component, $state){
..
})
->mask('(999) 999-9999')
->numeric()
->required()
->stripCharacters(['(', ')', ' ', '-'])
->lazy()
TextInput::make('phone')
->placeholder('Phone Number')
->minLength(10)
->maxLength(14)
->afterStateUpdated(function (TextInput $component, $state){
..
})
->mask('(999) 999-9999')
->numeric()
->required()
->stripCharacters(['(', ')', ' ', '-'])
->lazy()
1 Reply
awcodes
awcodes3mo ago
$state = preg_replace("/\D/", '', $state);
$state = preg_replace("/\D/", '', $state);
Want results from more Discord servers?
Add your server