Log in

View Full Version : Profile Field Text Verification


Desert VB
10-30-2007, 08:24 PM
I've searched/found/read quite a few threads on how to add custom profile fields but I can't find anywhere that explains how to "screen" what is entered.

For example, I added a profile field "Zip Code". How would I force a numeric entry of 5 digits? I get people entering a couple letters to get past the requirement instead of updating it properly.

Thanks!

--Phillip

Marco van Herwaarden
10-31-2007, 09:24 AM
You can add a REGEX to verify the contents.

Desert VB
10-31-2007, 12:42 PM
Regex?

Marco van Herwaarden
10-31-2007, 12:49 PM
See 'Regular Expression' when editing the User Profile Field. See the help and the link to PCRE.

Desert VB
10-31-2007, 02:17 PM
Ahhh, Yes, I saw that field/option when updating the profile fields, but the PCRE link made NO sense. :(

The field for RegEx is only 1 line, and fairly short in length. The PCRE help link only shows email validation examples, and they take several lines of code to make work.

--------------- Added 1193844115 at 1193844115 ---------------

Upon further reading, can I just enter this into the field?

/^[0-9][0-9][0-9][0-9][0-9]$/

--------------- Added 1193844115 at 1193844115 ---------------

Ok, that didn't work, so I just used:

[0-9][0-9][0-9][0-9][0-9]

And it worked. Thanks!

Now how would I allow unlimited chars A-z, but exclude 0-9 and all special chars?

LOL, My head hurts.