SMF Support > SMF 2.0.x Support
Profile Field Numeric
Arantor:
Did you actually then RE-ENTER the number?
pixelpadre:
no. But now that I did, that works. hypens work also. Big thanks :)
pixelpadre:
--- Quote from: Arantor on May 26, 2012, 11:23:22 PM ---That's because it treats it as a regular number where the 0 is not expected.
Instead, set it to regex and use:
--- Code: ---/\d{1,8}/
--- End code ---
as the mask.
--- End quote ---
What language is that, and can you tell me the exact meaning so I dont have to ask again.
MrPhil:
To allow up to 8 digits and hyphens:
--- Code: ---/[\-\d]{1,8}/
--- End code ---
It's even possible to restrict the hyphen(s) to particular places in the sequence. For example, an SSN:
--- Code: ---/\d{3,}-\d{2,}-\d{4,}/
--- End code ---
MrPhil:
This is regular expression to see if the input text matches a certain pattern. In order for you preserve the leading zero(es), you would have to treat this text (once it passes the mask test) as a string and not as a number. Otherwise, the number gets converted to binary format and then when it's printed out for display, it's lost its leading zero(es).
I'll leave it to someone familiar with the Profile Field how to handle the field as a string and not as a number.
Navigation
[0] Message Index
[*] Previous page
Go to full version