Results 1 to 3 of 3

Thread: Throwing variables around[RSLV]

  1. #1

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    Throwing variables around[RSLV]

    Ok, heres the problem. Take alook at this line.

    HTML + ASP\Javascript
    Code:
    <INPUT TYPE="TEXT" NAME="txtBody" VALUE="<%=objCategory('Body')%>">
    Whats wrong with this line you may ask. Well, objCategory is a recordset that is pulling up a field. If there is a ' or " in that field it totally messes up the text input. Thats not the worst of it, if there is a \n character in there or something it starts writing outside of the text field all over my page. How can i fix this?

    Looking for ' and " and replacing them with \' \" is one option. How do i search for new lines though.

    I'm using ASP with JScript.

    Ugh how frustrating.

    Thanks ladies and gents
    Last edited by invitro; Sep 23rd, 2004 at 08:32 PM.
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    First, when the data was being inserted, you should have done a

    Replace(stringname,"'","''")

    For now, when retrieving and displaying values, use the Replace() function and look for ' and " and vbCrLf.

  3. #3

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547
    The thing is that I'm using JScript, so there is no such thing as vbCrLf, is there?

    Second, i solved the problem by using a text area instead. Textareas seem to be unaffected by terminating charcters and so on since you are not inserting something in the VALUE but the field itself <>my text'</>

    So, for the future, search for ' and " and replace them with \' & \" ... i still dont know what newline is in Jscript oither then \n but that didnt seem to work.

    Anyhow, thanks for the reply i seem to got it working somehow.

    Cheers!
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

Posting Permissions

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



Click Here to Expand Forum to Full Width