Telephone format in text control - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Telephone format in text control

Last post 04-11-2015 05:29 PM by djm50. 31 replies.
Page 2 of 3 (32 items) < Previous 1 2 3 Next >
Sort Posts: Previous Next
  • 12-26-2013 02:25 PM In reply to

    Re: Telephone format in text control

    Okay so I tried that and it works great for US numbers. The problem I have is that I'm working for an international company with staff in various locations around the world. I need my text box to format phone number so that the country code shows up as well when people enter. So I've got users entering either just the regular 10-digit number or up to 12-digit number. I tried to adjust the rules that you had to fix this but I cannot get it to work (usually it chops off the last two in the 12-digit number) I want it so that if the user type in the 10-digit phone number the format comes out like this (ddd) ddd-dddd and if they type in a 12-digit number it comes out like this dd (ddd) ddd-dddd Is there a way to get this to work? It's driving me nuts!!
    Filed under:
  • 03-26-2015 05:24 AM In reply to

    Re: Telephone format in text control

    Hi I know this post is very old however its great... can you please help me format a number that is set up like this +12223334444. I would like it formatted like this 1 (123) 456-7890. Please I hope you get this message today because I am so trying to finish this project and I have searched the net and driving myself crazy. Thanks so much!!!
  • 03-26-2015 05:33 AM In reply to

    Re: Telephone format in text control

    Yes I just got your message. I have your solution. Give me a few to get it out to you.. :)
  • 03-26-2015 05:38 AM In reply to

    Re: Telephone format in text control

    OMG!!! Thank you so much.. I have been pulling my hair out....
  • 03-26-2015 05:46 AM In reply to

    Re: Telephone format in text control

    on the field you want to format put a rule: conditions: "Field you are formatting" does not match pattern "Phone Number Pattern" AND The expression "string-length(translate(., "()-. 0123456789", "")) = 0" AND Then run these actions: Set a fields value: The field you want formatted set it to the following value: concat("(", substring(translate(., "()-. ", ""), 1, 3), ") ", substring(translate(., "()-. ", ""), 4, 3), "-", substring(translate(., "()-. ", ""), 7, 4))
  • 03-26-2015 05:47 AM In reply to

    Re: Telephone format in text control

    That didnt come out too user friendly not sure why. I spaced everything out but it all came together when i submitted it. private message me your contact info if you dont get it..
  • 03-26-2015 05:50 AM In reply to

    Re: Telephone format in text control

    should look like this.... see attached
  • 03-26-2015 05:53 AM In reply to

    Re: Telephone format in text control

    I did what you said but it came out as the following: (+14) 103-6352... it cut the last two numbers... Did I do something wrong?
  • 03-26-2015 05:57 AM In reply to

    Re: Telephone format in text control

    ok I changed the last digit in the concat to a 6 and not a 4 and gained the last two digits back. However, it still looks very weird. i don't want the +. I just want it formated 1 (333) 444-7890.. Its now (+14) 222-635235
  • 03-26-2015 06:33 AM In reply to

    Re: Telephone format in text control

    do it like this....
  • 03-26-2015 07:23 AM In reply to

    Re: Telephone format in text control

    Hi is there anyway you can copy and paste this so that I can copy and paste this in infopath.. I have tried typing this formula a few times and still get errors.. Thanks
  • 03-26-2015 07:28 AM In reply to

    Re: Telephone format in text control

    concat(substring(translate(., "()-. ", ""), 1, 2), "(", substring(translate(., "()-. ", ""), 3, 3), ") ", substring(translate(., "()-. ", ""), 6, 3), "-", substring(translate(., "()-. ", ""), 9, 4))
  • 03-26-2015 07:30 AM In reply to

    Re: Telephone format in text control

    OMG you are so close... Its now +1) 123-222-4444..... I need to either get rid of the +1) or get rid of the + & ) and have the - inserted. Thank you so much!!!!
  • 03-26-2015 07:38 AM In reply to

    Re: Telephone format in text control

    also change the phone number pattern to a custom pattern: \+\d\(\d\d\d\) \d\d\d\-\d\d\d\d
  • 03-26-2015 07:47 AM In reply to

    Re: Telephone format in text control

    that + is throwing it off.....scrap everything...... make the set a fields value : concat(substring(translate(., "()-. ", ""), 1, 2), "(", substring(translate(., "()-. ", ""), 3, 3), ") ", substring(translate(., "()-. ", ""), 5, 3), "-", substring(translate(., "()-. ", ""), 8, 4)) condition is: Expression: not(xdUtil:Match(string(.), "\+\d\(\d\d\d\) \d\d\d\-\d\d\d\d")) AND Expression: string-length(translate(., "+()-. 0123456789", "")) = 0 AND Expression: string-length(translate(., "+()-. 0123456789", "")) = 0
Page 2 of 3 (32 items) < Previous 1 2 3 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.