Welcome to the Ifbyphone Developers zone. This forum provides a place for the community of advanced Ifbyphone users and developers to share ideas, exchange code, and ask questions.  

Additional Resources

Ifbyphone Company Blog - Ifbyphone Twitter Page - Ifbyphone Company Web Site - Ifbyphone Partners Page
Ifbyphone's CEO's (Irv Shapiro's) Personal Blog - Irv Shapiro Twitter Page

It has been brought to our attention that the NEW MEMBER link does not always display in IE7. If you do not see the new member link in the login box on the right, please try another browser. (Firefox works fine.) In addition please note that Phonemashup accounts are completely separate from Ifbyphone accounts.

If you need help fast, call 877 295 5100 to reach the Ifbyphone "Success Team".   (Support is option 2.)

Members Login
Username 
 
Password 
    Remember Me  
Chatbox
Please log in to join the chat!
Post Info TOPIC: How to format phone numbers for Dynamic Numbers


Member

Status: Offline
Posts: 7
Date: Aug 19, 2010
How to format phone numbers for Dynamic Numbers
  
 


If you don't like the standard format used in Dynamic Numbers (xxx) xxx-xxxx you can change this with just a little bit of Javascript.

The first step is setting the _ibp_formatting variable to false in the Javascript that goes in the <head> of the page. This causes the number to be returned as an unformatted string of digits.

<script type="text/JavaScript">
var _ibp_public_key = "1234567890a";
var _ibp_formatting = false;
var _ibp_keyword_set = 1234;
</script>

Next insert the phone number as you normally would but put it inside an element that's hidden so it doesn't get displayed. When this script is included it sets a Javascript variable called _ibp_phone_number that is set to the unformatted phone number.

<div style="display:none;">
<script type="text/JavaScript" src="https://secure.ifbyphone.com/js/keyword_replacement.js"></script>
</div>

Now that we have the number in a variable we can use Javascript to break it up and format it how we like:

<script>
/* Break apart the _ibp_phone_number variable
and insert whatever characters you want */

var new_number = _ibp_phone_number.substr(0,3) + "-" + _ibp_phone_number.substr(3,3) + "-" + _ibp_phone_number.substr(6);

/* This will now write xxx-xxx-xxxx instead of (xxx) xxx-xxxx */

document.write(new_number);
</script>


Attached is an HTML file with a full example.

Dan


Attachments
__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Post to Facebook Post to Digg Post to Del.icio.us

This is an open and public forum so Ifbyphone is unable to ensure that all code and suggestions posted to this forum are correct. Please use all code posted here at your own risk. Ifbyphone assumes no liability for code, recommendations and suggestions posted to this forum.

Users and developers will find hundreds of useful posts at the Ifbyphone company blog.