[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Converting phone format from "XXXAAABBBB" to "(XXX) AAA-BBBB".

Posted on 2004-09-15
14
Medium Priority
?
242 Views
Last Modified: 2010-04-25
HI,

Can someone walk me through creating a plug in for dreamweaver that will convert phone numbers from the format "XXXAAABBBB" to "(XXX) AAA-BBBB" using ASP. We do this frequently and I want to convert my ASP script to something that is useable as an extension that I can distribute to the rest of my staff.

Thanks.
0
Comment
Question by:BuddhaNature
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 14

Accepted Solution

by:
Esopo earned 2000 total points
ID: 12071613
Wait a second,

Do you want a code snippet of an ASP function that receives a number and parses it, or do you want an extension that automatically reformats selected text in DreamWeaver?

If what you want is the first, an ASP function that receives a number and returns it reformatted, I don't see the need for an extension, you can insert the function into your snippets library (Shft + F9) were it is easy to find and reuse (that's what the snippets library is for).

This would be your code:

 "XXXAAABBBB" to "(XXX) AAA-BBBB"

*******************************

function FormatNumber(TheNumber)
   FormatNumber="(" & Left(TheNumber,3) & ") " & Mid(TheNumber,4,3) & "-" & Right(TheNumber, 4)
End function

*******************************


Adding it to your snippets library is better for a few reasons:
1. Is easy
2. You can modify it whenever you please
3. You can group it with similar snippets
4. You can add more snippets to the group in a flash



You can easily install this into any computer by copying the snippet file that is located in the configuration/snippets folder of your PC.
That is something like:
c:\program files\macromedia\dreamweaver mx\configuration\snippets



Still, you can convert this code to a DW extension or an Object (much more suited for your situation) rather easily:

- Creating custom objects
http://www.dmxzone.com/ShowDetail.asp?NewsId=479

- Creating a simple commands extension
http://www.macromedia.com/support/dreamweaver/extend/creating_simple_cmmd_ext/


Hope this helps,

Esopo.
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12071624
Something like:

<%

myphone = "XXXAAABBBB"
'or later replace it with the value from database, like myphone = Rs("phone")

if len(myphone ) = 10 then
    newphone = "(" & left(myphone, 3) & ") " & mid(myphone, 4, 3) & "-" & Right(myphone, 4)
end if

response.write "newphone = " & newphone

%>

Hope this helps
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12071627
sigh.. i was too slow..  ;-)
0
Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

 
LVL 14

Expert Comment

by:Esopo
ID: 12283336
Not that I mind spliting points with my fellow DWs ;)... I don't see the anything that my answer lacks...
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12283411
Esopo provides complete solution, nah.. I was a bit slow typing there, so he deserves full pts, np, cheers 8-)
0
 
LVL 1

Author Comment

by:BuddhaNature
ID: 12288645
Actually, no one should get the points - yet. My question was about how to integrate an ASP script into dreamweaver as an extension, not on writing the actual ASP script itself.

My goal is to modularize (new word?) many of the common ASP scripts that I use and incorporate them into Dreamweaver for point and click use as well as for internal distribution.

Nonetheless, thanks for your replys.

Peace.
0
 
LVL 14

Expert Comment

by:Esopo
ID: 12291457
Did you read my post?

If you felt my answer did not fully (or partially) adressed  your question, why didn't you say something?
0
 
LVL 14

Expert Comment

by:Esopo
ID: 12322196
Don't know about the points but I recommend a PAQ since my first post is extremely informative and helpful (the part about snippets, custom objects and extensions).
0
 
LVL 14

Expert Comment

by:Esopo
ID: 12322209
Actually, I do know about the points but I don't feel its my place to say.
0
 
LVL 1

Expert Comment

by:chief77
ID: 12333663
is it an ASP script page that will process the data entered? or a Dreamweaver Extension?

where is this "phone number" coming in? via web page or when you entering them into a webpage as HTML code?

is it always 10 digits?
0
 
LVL 14

Expert Comment

by:Esopo
ID: 12333699
Chief,

Is not about the ASP. As unclear as the Q was, we now understand he wanted to make his snippet an extension.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question