input mask

FilMar

Member
I have a field to store a formatted number as 3 groups of 3 digits like this: 999-999-999
I did this using the input mask, no problem but it is stored in the database the same way (with the dashes (-))

Is there a way that the users see it like this and can enter it like this but it is stored in the database without the dashes?

Thanks in advance,

Filip
 
Hmmm.

You could try putting a PHP validation on it, set to "replace", that does something like ...

Code:
$myTriplets = explode('-', $data);
return implode('', $data);

... or use a regex to replace - with nothing, etc. Any approach that returns just the numbers.

That should store it as just the numbers. What I'm not sure about is if it'll then re-display with the hyphens when you edit it again. I suspect it might not, but you may get lucky. Let me know.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top