Skip navigation
Currently Being Moderated

Phone Number Format in Dreamweaver CS5 Form

Feb 7, 2013 11:43 AM

I am trying to add a phone number field using the spry text field in a form. It does not create the format. Also how can I change the text from being bold in the form to normal.

Thanks!

 
Replies
  • Currently Being Moderated
    Feb 7, 2013 11:48 AM   in reply to heatherfar69

    It does not create the format.

     

    #1 What format are you expecting?

     

     

    #2 Use CSS to style your form

     

    form {

    font-weight:normal

    }

     

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2013 12:16 PM   in reply to Nancy O.

    Here's a little script I found that will format the phone number when they move to the next field in the form...

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Phone Number</title>

    <script language="javascript">

    function addDashes(f)

    {

    f.value = f.value.slice(0,3)+"-"+f.value.slice(3,6)+"-"+f.value.slice(6,10);

    }

    </script>

    </head>

    <body>

    <form>

    Phone: <input type='text' name='phone' onblur='addDashes(this)'><br />

    Cell: <input type='text' name='cell' onblur='addDashes(this)'><br />

    Home: <input type='text' name='home' onblur='addDashes(this)'><br />

    </form>

    </body>

    </html>

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2013 12:36 PM   in reply to heatherfar69

    Did you include the JavaScript code in the head of your page?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2013 12:56 PM   in reply to heatherfar69

    Go back to post #2.  Copy & paste the code Jon gave you into a new, blank HTML document.  Save and preview in browsers.

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2013 1:04 PM   in reply to Nancy O.

    Specifically, the bold portion of my post with the <script>...</script> needs to be added between your page's <head> tags.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points