Score:0

Format telephone numbers for values

us flag

I have created a webform with telephone field, the submitted data is displayed in a views table, however the numbers in submitted data are in random format such as 1234567890, 234-987-9870, how do I configure the number field in views to be displayed in (123) 123 1234 format for the existing values and new submission.

id flag
Does this work with Views? https://www.drupal.org/project/telephone_formatter
Jake13 avatar
us flag
@cilefen, there is no view format options for the module
Score:0
cn flag

If you are able to use Jquery here is a solution:

$('.phone').text(function(i, text) { return text.replace(/(\d\d\d)(\d\d\d)(\d\d\d\d)/, '$1-$2-$3'); });

http://jsfiddle.net/Xxk3F/1/

Answer found at: https://stackoverflow.com/questions/8760070/how-to-format-a-phone-number-with-jquery

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.