Adding removing spaces in phone numbers db/web

Discussion in 'ASP General' started by mettá, Aug 23, 2009.

  1. mettá

    mettá Guest

    I have phone numbers stored in a db as xxxxx xxxxxx however I am starting to
    set up a mobile/pda site and the numbers need to disply as xxxxxxxxxxx (no
    spaces) for the call link to work

    I can edit the db to remove the spaces BUT would like then to display on the
    main web site with a space. Anyone know a simple solution???

    Thanks
    M
     
    mettá, Aug 23, 2009
    #1
    1. Advertising

  2. mettá

    Evertjan. Guest

    mettá wrote on 23 aug 2009 in microsoft.public.inetserver.asp.general:
    > I have phone numbers stored in a db as xxxxx xxxxxx however I am
    > starting to set up a mobile/pda site and the numbers need to disply as
    > xxxxxxxxxxx (no spaces) for the call link to work



    Are you sure this is not a school assignment?

    <% 'vbs
    tel = "12345 678901"
    response.write onlyNumbers(tel)
    %>

    <script type='text/javascript' runar='server'>
    function onlyNumbers(x) {
    return x.replace(/\D+/g,'');
    };
    </script>

    > I can edit the db to remove the spaces BUT would like then to display
    > on the main web site with a space. Anyone know a simple solution???


    How would you know where the spaces used to be?
    Or is there a rule for your country?

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Aug 23, 2009
    #2
    1. Advertising

  3. mettá

    mettá Guest

    Hi, thanks for your response but I cannot get this working, I have also
    tried;

    <%
    phonNum=FP_FieldVal(fp_rs,"tel")
    replace phonNum," ",""
    response.write phonNum
    %>

    But it fails to remove any spaces!

    I also tried
    <%
    tel2 = FP_FieldVal(fp_rs,"tel")
    response.write onlyNumbers(tel2)
    %>

    I then get the error;
    Error Type:
    Microsoft VBScript runtime (0x800A000D)
    Type mismatch: 'onlyNumbers'


    What am I doing wrong here??
    Thanks
    M


    "Evertjan." <> wrote in message
    news:Xns9C70D9885C97Deejj99@194.109.133.242...
    > mettá wrote on 23 aug 2009 in microsoft.public.inetserver.asp.general:
    >> I have phone numbers stored in a db as xxxxx xxxxxx however I am
    >> starting to set up a mobile/pda site and the numbers need to disply as
    >> xxxxxxxxxxx (no spaces) for the call link to work

    >
    >
    > Are you sure this is not a school assignment?
    >
    > <% 'vbs
    > tel = "12345 678901"
    > response.write onlyNumbers(tel)
    > %>
    >
    > <script type='text/javascript' runar='server'>
    > function onlyNumbers(x) {
    > return x.replace(/\D+/g,'');
    > };
    > </script>
    >
    >> I can edit the db to remove the spaces BUT would like then to display
    >> on the main web site with a space. Anyone know a simple solution???

    >
    > How would you know where the spaces used to be?
    > Or is there a rule for your country?
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    mettá, Aug 29, 2009
    #3
  4. mettá

    mettá Guest

    Sorted it now with the help of SRB
    The following is the answer!

    <%
    phonNum=FP_FieldVal(fp_rs,"tel")
    If len(phonNum)>0 then
    phonNum=replace(phonNum," ","")
    Else
    phonNum="None"
    End If%>
    response.write(phonNum)
    %>

    Thanks for trying!
    M


    "Evertjan." <> wrote in message
    news:Xns9C70D9885C97Deejj99@194.109.133.242...
    > mettá wrote on 23 aug 2009 in microsoft.public.inetserver.asp.general:
    >> I have phone numbers stored in a db as xxxxx xxxxxx however I am
    >> starting to set up a mobile/pda site and the numbers need to disply as
    >> xxxxxxxxxxx (no spaces) for the call link to work

    >
    >
    > Are you sure this is not a school assignment?
    >
    > <% 'vbs
    > tel = "12345 678901"
    > response.write onlyNumbers(tel)
    > %>
    >
    > <script type='text/javascript' runar='server'>
    > function onlyNumbers(x) {
    > return x.replace(/\D+/g,'');
    > };
    > </script>
    >
    >> I can edit the db to remove the spaces BUT would like then to display
    >> on the main web site with a space. Anyone know a simple solution???

    >
    > How would you know where the spaces used to be?
    > Or is there a rule for your country?
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    mettá, Aug 29, 2009
    #4
  5. mettá

    Evertjan. Guest

    mettá wrote on 29 aug 2009 in microsoft.public.inetserver.asp.general:

    [Please do not toppost on usenet]

    > Sorted it now with the help of SRB
    > The following is the answer!


    Perhaps "a", but do not flater yourself bij knowing "the".


    > <%
    > phonNum=FP_FieldVal(fp_rs,"tel")


    > If len(phonNum)>0 then
    > phonNum=replace(phonNum," ","")


    I would remove all the spaces first.
    Then an entry like
    phonNum = " "
    would also work,
    and the code is more compact.

    =====================================
    <%
    phonNum = FP_FieldVal(fp_rs,"tel")
    phonNum = replace(phonNum," ","")
    If len(phonNum)=0 then
    phonNum="None"
    End If
    response.write phonNum
    %>
    =====================================

    > Else
    > phonNum="None">

    End If> %>
    response.write(phonNum)
    %>

    This will never work, two %> in succession

    Next time copy paste your working code and do not retype, I suggest.


    You seem to have a problem with the () logic of VBS.

    > response.write(phonNum)


    response.write phonNum

    Statements do not need () around the parameters,
    and if there are more than one paramater they cannot have them,
    so better NEVER use () as statement parameter delimiters.

    A function on the other hand needs them.

    phonNum = replace(phonNum," ","")

    >>> replace phonNum," ",""


    This is just nonsense, because also you did not use the result.

    > %>
    >
    > Thanks for trying!


    Trying what?

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Aug 29, 2009
    #5
  6. mettá

    mettá Guest

    Hi Evertjan

    Well now, the answer I posted was AN answer, it worked, the (<%) was
    missing at the start of response.write I posted in my reply! sorry about
    that. I'm not flattering myself I was if anything flattering SRB, I was also
    thanking you for trying to help, sadly what you offered did not work for me.
    The actual code (true copy) that works (for me) is;

    <%
    phonNum=FP_FieldVal(fp_rs,"tel")
    If len(phonNum)>0 then
    phonNum=replace(phonNum," ","")
    Else
    phonNum="None"
    End If
    %>
    ....
    <p>Tel:<a href="tel:<%=(phonNum)%>"><%=FP_FieldVal(fp_rs,"Tel")%></a></p>

    This produces
    Tel:12345 678 901
    and the link: tel:12345678901


    If you can see anything wrong or excessive about this please let me know.
    M





    "Evertjan." <> wrote in message
    news:Xns9C768915649C1eejj99@194.109.133.242...
    > mettá wrote on 29 aug 2009 in microsoft.public.inetserver.asp.general:
    >
    > [Please do not toppost on usenet]
    >
    >> Sorted it now with the help of SRB
    >> The following is the answer!

    >
    > Perhaps "a", but do not flater yourself bij knowing "the".
    >
    >
    >> <%
    >> phonNum=FP_FieldVal(fp_rs,"tel")

    >
    >> If len(phonNum)>0 then
    >> phonNum=replace(phonNum," ","")

    >
    > I would remove all the spaces first.
    > Then an entry like
    > phonNum = " "
    > would also work,
    > and the code is more compact.
    >
    > =====================================
    > <%
    > phonNum = FP_FieldVal(fp_rs,"tel")
    > phonNum = replace(phonNum," ","")
    > If len(phonNum)=0 then
    > phonNum="None"
    > End If
    > response.write phonNum
    > %>
    > =====================================
    >
    >> Else
    >> phonNum="None">

    > End If> %>
    > response.write(phonNum)
    > %>
    >
    > This will never work, two %> in succession
    >
    > Next time copy paste your working code and do not retype, I suggest.
    >
    >
    > You seem to have a problem with the () logic of VBS.
    >
    >> response.write(phonNum)

    >
    > response.write phonNum
    >
    > Statements do not need () around the parameters,
    > and if there are more than one paramater they cannot have them,
    > so better NEVER use () as statement parameter delimiters.
    >
    > A function on the other hand needs them.
    >
    > phonNum = replace(phonNum," ","")
    >
    >>>> replace phonNum," ",""

    >
    > This is just nonsense, because also you did not use the result.
    >
    >> %>
    >>
    >> Thanks for trying!

    >
    > Trying what?
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    mettá, Aug 29, 2009
    #6
  7. mettá

    Evertjan. Guest

    mettá wrote on 29 aug 2009 in microsoft.public.inetserver.asp.general:

    > Hi Evertjan
    >
    > Well now, the answer I posted was AN answer, it worked, the (<%) was
    > missing at the start of response.write I posted in my reply! sorry
    > about that. I'm not flattering myself I was if anything flattering
    > SRB, I was also thanking you for trying to help, sadly what you
    > offered did not work for me. The actual code (true copy) that works
    > (for me) is;
    >
    > <%
    > phonNum=FP_FieldVal(fp_rs,"tel")
    > If len(phonNum)>0 then
    > phonNum=replace(phonNum," ","")
    > Else
    > phonNum="None"
    > End If
    > %>
    > ...
    > <p>Tel:<a
    > href="tel:<%=(phonNum)%>"><%=FP_FieldVal(fp_rs,"Tel")%></a></p>
    >
    > This produces
    > Tel:12345 678 901
    > and the link: tel:12345678901
    >
    >
    > If you can see anything wrong or excessive about this please let me
    > know. M



    Seems you did not read my answer at all!

    1
    You persist in topposting.

    2
    You do not note the improvement I suggested.

    3
    You make the mistake by sometimes letting "tel:None" be entered in the href
    link, while you put an empty string in the clickable link text.

    4
    There is no reason to put () here:
    > href="tel:<%=(phonNum)%>">


    5
    "tel: in the link text will probably get you nowhere, since the usual link
    form [skype, mobile phones] is "callto:"

    try [you, not me]:

    <p>
    Phone: <a href='callto:<% = phonNum %>'><%=phonNum%></a>
    </p>

    6
    and please, do not quote signatures in your responses.


    > "Evertjan." <> wrote in message
    > news:Xns9C768915649C1eejj99@194.109.133.242...
    >> mettá wrote on 29 aug 2009 in
    >> microsoft.public.inetserver.asp.general:
    >>
    >> [Please do not toppost on usenet]
    >>
    >>> Sorted it now with the help of SRB
    >>> The following is the answer!

    >>
    >> Perhaps "a", but do not flater yourself bij knowing "the".
    >>
    >>
    >>> <%
    >>> phonNum=FP_FieldVal(fp_rs,"tel")

    >>
    >>> If len(phonNum)>0 then
    >>> phonNum=replace(phonNum," ","")

    >>
    >> I would remove all the spaces first.
    >> Then an entry like
    >> phonNum = " "
    >> would also work,
    >> and the code is more compact.
    >>
    >> =====================================
    >> <%
    >> phonNum = FP_FieldVal(fp_rs,"tel")
    >> phonNum = replace(phonNum," ","")
    >> If len(phonNum)=0 then
    >> phonNum="None"
    >> End If
    >> response.write phonNum
    >> %>
    >> =====================================
    >>
    >>> Else
    >>> phonNum="None">

    >> End If> %>
    >> response.write(phonNum)
    >> %>
    >>
    >> This will never work, two %> in succession
    >>
    >> Next time copy paste your working code and do not retype, I suggest.
    >>
    >>
    >> You seem to have a problem with the () logic of VBS.
    >>
    >>> response.write(phonNum)

    >>
    >> response.write phonNum
    >>
    >> Statements do not need () around the parameters,
    >> and if there are more than one paramater they cannot have them,
    >> so better NEVER use () as statement parameter delimiters.
    >>
    >> A function on the other hand needs them.
    >>
    >> phonNum = replace(phonNum," ","")
    >>
    >>>>> replace phonNum," ",""

    >>
    >> This is just nonsense, because also you did not use the result.
    >>
    >>> %>
    >>>
    >>> Thanks for trying!

    >>
    >> Trying what?




    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Aug 29, 2009
    #7
  8. mettá

    mettá Guest

    Hi

    My way is to top post, however...


    "Evertjan." <> wrote in message
    news:Xns9C76A9D9E70DBeejj99@194.109.133.242...
    > mettá wrote on 29 aug 2009 in microsoft.public.inetserver.asp.general:
    >
    >> Hi Evertjan
    >>
    >> Well now, the answer I posted was AN answer, it worked, the (<%) was
    >> missing at the start of response.write I posted in my reply! sorry
    >> about that. I'm not flattering myself I was if anything flattering
    >> SRB, I was also thanking you for trying to help, sadly what you
    >> offered did not work for me. The actual code (true copy) that works
    >> (for me) is;
    >>
    >> <%
    >> phonNum=FP_FieldVal(fp_rs,"tel")
    >> If len(phonNum)>0 then
    >> phonNum=replace(phonNum," ","")
    >> Else
    >> phonNum="None"
    >> End If
    >> %>
    >> ...
    >> <p>Tel:<a
    >> href="tel:<%=(phonNum)%>"><%=FP_FieldVal(fp_rs,"Tel")%></a></p>
    >>
    >> This produces
    >> Tel:12345 678 901
    >> and the link: tel:12345678901
    >>
    >>
    >> If you can see anything wrong or excessive about this please let me
    >> know. M

    >
    >
    > Seems you did not read my answer at all!
    >
    > 1
    > You persist in topposting.


    I hear you.

    >
    > 2
    > You do not note the improvement I suggested.
    >


    That is because I could not clearly understand what you were saying, however
    <%
    phonNum=FP_FieldVal(fp_rs,"tel")
    phonNum = replace(phonNum," ","")
    response.write phonNum
    %>

    works too!

    > 3
    > You make the mistake by sometimes letting "tel:None" be entered in the
    > href
    > link, while you put an empty string in the clickable link text.
    >


    I agree EXCEPT there is other code that knows if a tel field is empty or
    less than x characters.
    > 4
    > There is no reason to put () here:
    >> href="tel:<%=(phonNum)%>">


    Hmm, this depends on which method I use, if the working example I gave in my
    previous response is used the () is required!

    >
    > 5
    > "tel: in the link text will probably get you nowhere, since the usual link
    > form [skype, mobile phones] is "callto:"
    >
    > try [you, not me]:
    >
    > <p>
    > Phone: <a href='callto:<% = phonNum %>'><%=phonNum%></a>
    > </p>


    On the two web enabled phones I have they work with "tell:", "callto:" is
    for Skype

    >
    > 6
    > and please, do not quote signatures in your responses.


    What?

    Thanks
    M

    >
    >
    >> "Evertjan." <> wrote in message
    >> news:Xns9C768915649C1eejj99@194.109.133.242...
    >>> mettá wrote on 29 aug 2009 in
    >>> microsoft.public.inetserver.asp.general:
    >>>
    >>> [Please do not toppost on usenet]
    >>>
    >>>> Sorted it now with the help of SRB
    >>>> The following is the answer!
    >>>
    >>> Perhaps "a", but do not flater yourself bij knowing "the".
    >>>
    >>>
    >>>> <%
    >>>> phonNum=FP_FieldVal(fp_rs,"tel")
    >>>
    >>>> If len(phonNum)>0 then
    >>>> phonNum=replace(phonNum," ","")
    >>>
    >>> I would remove all the spaces first.
    >>> Then an entry like
    >>> phonNum = " "
    >>> would also work,
    >>> and the code is more compact.
    >>>
    >>> =====================================
    >>> <%
    >>> phonNum = FP_FieldVal(fp_rs,"tel")
    >>> phonNum = replace(phonNum," ","")
    >>> If len(phonNum)=0 then
    >>> phonNum="None"
    >>> End If
    >>> response.write phonNum
    >>> %>
    >>> =====================================
    >>>
    >>>> Else
    >>>> phonNum="None">
    >>> End If> %>
    >>> response.write(phonNum)
    >>> %>
    >>>
    >>> This will never work, two %> in succession
    >>>
    >>> Next time copy paste your working code and do not retype, I suggest.
    >>>
    >>>
    >>> You seem to have a problem with the () logic of VBS.
    >>>
    >>>> response.write(phonNum)
    >>>
    >>> response.write phonNum
    >>>
    >>> Statements do not need () around the parameters,
    >>> and if there are more than one paramater they cannot have them,
    >>> so better NEVER use () as statement parameter delimiters.
    >>>
    >>> A function on the other hand needs them.
    >>>
    >>> phonNum = replace(phonNum," ","")
    >>>
    >>>>>> replace phonNum," ",""
    >>>
    >>> This is just nonsense, because also you did not use the result.
    >>>
    >>>> %>
    >>>>
    >>>> Thanks for trying!
    >>>
    >>> Trying what?

    >
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    mettá, Aug 29, 2009
    #8
  9. mettá

    mettá Guest

    Hi

    My way is to top post, however...


    "Evertjan." <> wrote in message
    news:Xns9C76A9D9E70DBeejj99@194.109.133.242...
    > mettá wrote on 29 aug 2009 in microsoft.public.inetserver.asp.general:
    >
    >> Hi Evertjan
    >>
    >> Well now, the answer I posted was AN answer, it worked, the (<%) was
    >> missing at the start of response.write I posted in my reply! sorry
    >> about that. I'm not flattering myself I was if anything flattering
    >> SRB, I was also thanking you for trying to help, sadly what you
    >> offered did not work for me. The actual code (true copy) that works
    >> (for me) is;
    >>
    >> <%
    >> phonNum=FP_FieldVal(fp_rs,"tel")
    >> If len(phonNum)>0 then
    >> phonNum=replace(phonNum," ","")
    >> Else
    >> phonNum="None"
    >> End If
    >> %>
    >> ...
    >> <p>Tel:<a
    >> href="tel:<%=(phonNum)%>"><%=FP_FieldVal(fp_rs,"Tel")%></a></p>
    >>
    >> This produces
    >> Tel:12345 678 901
    >> and the link: tel:12345678901
    >>
    >>
    >> If you can see anything wrong or excessive about this please let me
    >> know. M

    >
    >
    > Seems you did not read my answer at all!
    >
    > 1
    > You persist in topposting.


    I hear you.

    >
    > 2
    > You do not note the improvement I suggested.
    >


    That is because I could not clearly understand what you were saying, however
    <%
    phonNum=FP_FieldVal(fp_rs,"tel")
    phonNum = replace(phonNum," ","")
    response.write phonNum
    %>

    works too!

    > 3
    > You make the mistake by sometimes letting "tel:None" be entered in the
    > href
    > link, while you put an empty string in the clickable link text.
    >


    I agree EXCEPT there is other code that knows if a tel field is empty or
    less than x characters.
    > 4
    > There is no reason to put () here:
    >> href="tel:<%=(phonNum)%>">


    Hmm, this depends on which method I use, if the working example I gave in my
    previous response is used the () is required!

    >
    > 5
    > "tel: in the link text will probably get you nowhere, since the usual link
    > form [skype, mobile phones] is "callto:"
    >
    > try [you, not me]:
    >
    > <p>
    > Phone: <a href='callto:<% = phonNum %>'><%=phonNum%></a>
    > </p>


    On the two web enabled phones I have they work with "tel:", "callto:" is
    for Skype

    >
    > 6
    > and please, do not quote signatures in your responses.


    What?

    Thanks
    M

    >
    >
    >> "Evertjan." <> wrote in message
    >> news:Xns9C768915649C1eejj99@194.109.133.242...
    >>> mettá wrote on 29 aug 2009 in
    >>> microsoft.public.inetserver.asp.general:
    >>>
    >>> [Please do not toppost on usenet]
    >>>
    >>>> Sorted it now with the help of SRB
    >>>> The following is the answer!
    >>>
    >>> Perhaps "a", but do not flater yourself bij knowing "the".
    >>>
    >>>
    >>>> <%
    >>>> phonNum=FP_FieldVal(fp_rs,"tel")
    >>>
    >>>> If len(phonNum)>0 then
    >>>> phonNum=replace(phonNum," ","")
    >>>
    >>> I would remove all the spaces first.
    >>> Then an entry like
    >>> phonNum = " "
    >>> would also work,
    >>> and the code is more compact.
    >>>
    >>> =====================================
    >>> <%
    >>> phonNum = FP_FieldVal(fp_rs,"tel")
    >>> phonNum = replace(phonNum," ","")
    >>> If len(phonNum)=0 then
    >>> phonNum="None"
    >>> End If
    >>> response.write phonNum
    >>> %>
    >>> =====================================
    >>>
    >>>> Else
    >>>> phonNum="None">
    >>> End If> %>
    >>> response.write(phonNum)
    >>> %>
    >>>
    >>> This will never work, two %> in succession
    >>>
    >>> Next time copy paste your working code and do not retype, I suggest.
    >>>
    >>>
    >>> You seem to have a problem with the () logic of VBS.
    >>>
    >>>> response.write(phonNum)
    >>>
    >>> response.write phonNum
    >>>
    >>> Statements do not need () around the parameters,
    >>> and if there are more than one paramater they cannot have them,
    >>> so better NEVER use () as statement parameter delimiters.
    >>>
    >>> A function on the other hand needs them.
    >>>
    >>> phonNum = replace(phonNum," ","")
    >>>
    >>>>>> replace phonNum," ",""
    >>>
    >>> This is just nonsense, because also you did not use the result.
    >>>
    >>>> %>
    >>>>
    >>>> Thanks for trying!
    >>>
    >>> Trying what?

    >
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    mettá, Aug 29, 2009
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zahoor
    Replies:
    1
    Views:
    827
    Darryl L. Pierce
    Nov 15, 2003
  2. John B. Matthews
    Replies:
    4
    Views:
    681
    John B. Matthews
    Sep 12, 2008
  3. Roedy Green
    Replies:
    3
    Views:
    641
  4. chen selina
    Replies:
    0
    Views:
    896
    chen selina
    Jul 7, 2010
  5. Rene Ivon Shamberger

    convert Phone Letters to Phone numbers

    Rene Ivon Shamberger, Dec 4, 2012, in forum: C++
    Replies:
    5
    Views:
    405
Loading...

Share This Page