Phone format with optional extension

By: Rob LeVine | Asked: 02/19/2023
ForumsCategory: General questionsPhone format with optional extension
Rob LeVineRob LeVine asked 1 year ago
I've tried so many different options to have users enter an "American" phone number with an optional extension of an unknown number of digits.  So, something like (999) 999-9999 x##### I've tried an absurd amount of variations, including using regex and I can't get anything to work with the FF phone field. Did anyone successfully accomplish this?  My feelings won't be hurt if the answer is really simple :).
3 Answers
Walter JonesWalter Jones answered 1 year ago
Can use a text field instead?
Bobby Clapp answered 1 year ago
Rob LeVineRob LeVine replied 1 year ago

Amusingly enough that was one of the zillion StackOverflow answers I went through and none of them worked. Though your answer inspired me to reread the FF documentation and it says to wrap the regex as ^regex$, which I could swear was not what the docs said the last time I looked. Anyway, it works now :).

https://formidableforms.com/knowledgebase/format/#kb-syntax

Larry Kolinek replied 11 months ago

@Rob LeVine ... between the 2 links (lots of info), is it possible you can give the final answer that works? 🙂

I'm assuming you have a text field and you just add the regex that handles any phone number?

thank you very much!!!!

Larry Kolinek replied 11 months ago

oh... just realized, i was looking for a phone number field, that handles international AND US phone numbers

Larry Kolinek answered 8 months ago
@Rob LeVine @Bobby Clapp  I'm not able to make this work? you can see the attachment, what is wrong?   can't the formatting tell the user the format? thanks!
Attachments
Rob LeVineRob LeVine replied 8 months ago

Larry, I gotta tell ya, I finally gave up. It worked...for a hot minute. And then it stopped working and I could never get it to stop choking itself. There are so many sites that have great ways of doing phone number formatting and I think FF has to step up its game and implement something that everyone can use - a field with all sorts of options to check and then in the background, FF does the heavy lifting.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right