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 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Plano, Texas
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quotes In Dynamic Form

    I'm trying to resolve my problem reading the above sticky posts where the forum offers scripts and tips about single quotes etc. But, I am still having a little problem

    MSAcess 2000 SQl Statement

    On a form I can Capture Field Data [strDescr]: Mr. Jone's "Bank"
    On Update or Insert I have a similar function that takes care of replacing the (') in Mr. Jone's prior to updating the Table field.

    When I write a dynamic form with response.write for subsequent editing and update... using SELECT
    to pull out the record..e.g.

    strDescr = rs("strDescr")

    Response.write( "<input type='text' value='" & strDescr & "name='Description' size='50'>" )

    On the new form I get output like below in the text box:

    Description: Mr. Jone's &quot;Bank&quot;

    Where It Should be; Mr. Jone's "Bank"

    Would someone please set me straight on this one.

    TIA

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    <%
    strDescr = rs("strDescr")
    Response.write( "<input type=""text"" value=""" & server.htmlencode(strDescr) & """ name=""Description"" size=""50"">")
    %>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Plano, Texas
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you!

    Ooops! When I tried this with: Mr. Jone's "Bank"

    The output was:

    Mr Jone’s &amp;quot;bank&amp;quot;
    Last edited by JoeP; 02-17-2003 at 03:19 PM.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    yes, but since you will output it inside the textbox or even as html text, it would be displayed/rendered correctly.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah, you shouldn't actually change the variable that you are requesting from the database or webpage using Server.HTMLEncode(). That will corrupt your data!

    You only want to change it while you are displaying it in HTML with Server.HTMLEncode().

    Try using Server.HTMLEncode() ONLY while you are printing the variable to the webpage... like:

    <p><% Response.Write(Server.HTMLEncode("myvariable")) %></p>

    Get it?
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    but if you are putting it in a javascript variable, you have to escape those characters according to javascript syntax:
    see this thread: http://www.codingforums.com/showthre...threadid=10513
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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