Results 1 to 15 of 15

Thread: Text capture

  1. #1
    Join Date
    Jan 2004
    Posts
    11

    Question Unanswered: Text capture

    I was wondering how you go about capturing text as it is entere into a textarea? i want it captured exactly as it is typed, with carriage returns and everything. is there an easy way to do this?

  2. #2
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    Are you in the right forum? I've never heard of a SQL textarea.
    -bpd

  3. #3
    Join Date
    Jan 2004
    Posts
    11
    no a textarea from an html form. i was wondering is there was a way to use MS SQL to capture it the way it was typed.

  4. #4
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    My guess is that you have an error in your page. Can you capture the data and write it back to your page to be sure you are getting it all first?

    It is likely (without having seen any of your code) that you need to deal with the quotation marks in you code, perhaps by replacing single quotes with double quotes before furthur processing.
    -bpd

  5. #5
    Join Date
    Jan 2004
    Posts
    11
    should this post belong in the ASP forum? if so, sorry about the confusion.

  6. #6
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    Maybe both. Can you post the bit of code you are having trouble with?
    -bpd

  7. #7
    Join Date
    Jan 2004
    Posts
    11
    its not any specific code. but when a user types a remark into a textarea on my site, and they put carriage returns in their remark, the carriage returns are ignored when the information is saved to the database. do i need to do some text manipulation before it is saved, or is there an easier way to just save what they typed in?

  8. #8
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    Sorry, I'm confusing two different posts (ignore the whole quote thing).

    If you are storing your data in either a VARCHAR or NVARCHAR field, it should maintain any CR in you data. If they are not appearing, it is because they are not making it into the database. It's possible that the textbox is not storing/sending them, or that they are being eliminated somewhere else in your code.
    -bpd

  9. #9
    Join Date
    Jan 2004
    Posts
    11
    well i am storing it as a VARCHAR, that is what is confusing me. i guess i will continue to look into the problem. thank you.

  10. #10
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    I would try collecting the data from the page and Response.Write'ing it back to be sure you are actually getting the whole thing.
    -bpd

  11. #11
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Look for a function call either in the same command that send the data to the server, or right before it. I actually had to implement something like this on certain fields, like name and address, in order to eliminate the wrapping on the labels.

  12. #12
    Join Date
    Jan 2004
    Posts
    35
    You can simply encode the string that you get from text area. You can use server.HTMLEncode or encodeURI function. But HTMLEncode may not work with Unicodes.
    Last edited by nanadmin; 01-30-04 at 17:26.

  13. #13
    Join Date
    Oct 2002
    Location
    Western part of Georgia, USA
    Posts
    123
    Don't know if this will be any help, but. I have several tables that have type varchar and are feed data via asp. From what I have seen, the data recognizes the carriage return as if you copy and paste the data into ms word, excel, or even notepad it uses the carriage return. response.write does not "see" it, however if you return the value in a text box it will "see" the return. for what it is worth! I edited this and pasted the value of a varchar (255) below is the result. In excel the CR looks like a square. again for what it is worth

    this is a test

    try to do it right
    Last edited by clinel; 01-30-04 at 21:16.

  14. #14
    Join Date
    Dec 2003
    Posts
    454
    You can try this:

    text = Replace(text, vbNewLine, "<br>")

  15. #15
    Join Date
    Jan 2004
    Posts
    11
    thank you all for your help. i am going to implement at least one of these.

Posting Permissions

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