Forums

Form with validating UK phone number entry?

dirntknow 08 Oct, 2010
Hi, first post so hello all! I've stumbled on the jem that is Chronoforms and as a new Joomla user found it to be ideal...almost! The problem I have is i'd like to have a form field where the user can/has to input their phone number in the following format: 01234 567890 with4 number, space then following four numbers but seem to have an issue of it not being a valid number. Can and how do I achieve this? I'm currently looking in the forum for a previous answer but found nothing so far...
Thanks...Andre
GreyHead 08 Oct, 2010
Hi Andre,

You can do this with a 'Custom validation' where you can use your own regular expression.

Bob
dirntknow 09 Oct, 2010
Hi Bob and thanks for the reply. Are we talking hard coding here as i've had a look around and can't find any mention of custom validation? I'm a noob to Joomla and PHP, I started to cut my teeth with php in Dreamweaver but found everything (not much!) I learned to do was bad practice and left too many doors open!
GreyHead 09 Oct, 2010
Hi Andre,

It's not trivial but not too difficult. If you use my ChronoSearch (from the Tutorials link above) and search on "custom validation" (with quotes) you'll find several worked examples.

If you search regexlib.com for UK Phone you'll find several Regular expressions that you could use or adapt.

Bob

PS Notice that London numbers 0208 81239999 don't fit your pattern, nor do Manchester or Birmingham, etc.

PPS There's a full 14 page Custom Validation doc for $10 here but it's probably more than you need right now.
This topic is locked and no more replies can be posted.