PDA

View Full Version : How Do I Validate Input Data, In Custome Fields


Come2Daddy
08-15-2010, 09:27 PM
Hi there,

I'm trying to add some custom fields the profile fields & I want to validate it's inputs, so for instance, let's say I want to add a mobile phone number field, & I want to ensure that the one who submit the mobile number can't insert any data type except numbers

any idea??

Boofo
08-15-2010, 09:33 PM
You can use regex to validate the input.

Come2Daddy
08-15-2010, 10:02 PM
This is exactly what I'm looking for, I don't know how to use the regular expression function within an integrated script,
where to use it??
where should I write my validation code?? in template??
or I should in vbulletin files??
or in some hooks places vbulletin provided them???

Boofo
08-15-2010, 10:12 PM
There is a place to add it in the profile field setup. ;)

Come2Daddy
08-15-2010, 11:16 PM
Are you serious, I can put any validation pattern in the custom field setup??? How?

Boofo
08-15-2010, 11:23 PM
Regular Expression (under Show on Member's List).

--------------- Added 1281918683 at 1281918683 ---------------

Try this for the regex:

^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$


It will have to look like this to pass:

555-123-4567

Come2Daddy
08-16-2010, 01:18 AM
I thought you're fooling around with me, because I was writing to you via my mobile phone, but when I get home back I checked my admincp & I found the pattern input field

Thanks a lot

Boofo
08-16-2010, 03:15 AM
No problem. ;)