Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quotes in a name

    I am dynamicaly creating a hyper link, to call a javascript function, passing a name from a database into the function.
    It all works until the name such as 'Hamish D'Sa' which has a ' in it, where the link then produces a syntax error because of the unmatched quotes.
    How do I code for this.
    The failing link is link is
    [code]
    <a href="javascript:showtickets(1,'Hamish D'Sa')">View Tickets</a>

  • #2
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have this working now.
    I replaced the ' in the name with %# in the link, and then replaced %# with '' (2 single quotes) as the sql required the name to be 'Hamish D''Sa' to correctlt process the query.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Code:
    <a href="#" onclick="showtickets(1,'Hamish D\'Sa');return false;">View Tickets</a>
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •