Professional Web Applications Themes

problems with some characters in TEXTAREA - Macromedia ColdFusion

Hello all, When characters like " are used in a textarea-field the content of the form is not exactly what you expect from it. When you want to insert for example 50 form-fields (a recordset) to a database and form-field number 41 contains for example the character " ... the last 9 form-fields are gone with the wind. I suppose that the code uses the character " for closing the recordset. My question: how to avoid this problem? I would like to keep using special characters in form-fields because they are needed for some languages of clients (for example French,...) ...

  1. #1

    Default problems with some characters in TEXTAREA

    Hello all,

    When characters like " are used in a textarea-field the content of the form is
    not exactly what you expect from it. When you want to insert for example 50
    form-fields (a recordset) to a database and form-field number 41 contains for
    example the character " ... the last 9 form-fields are gone with the wind. I
    suppose that the code uses the character " for closing the recordset.

    My question: how to avoid this problem? I would like to keep using special
    characters in form-fields because they are needed for some languages of clients
    (for example French,...)

    Thanks in advance,
    Rudy

    alpenman Guest

  2. #2

    Default Re: problems with some characters in TEXTAREA

    Hi! I 'clean' the text before inputting it into the database by converting the
    charactor ' and ' to other charactors palatable to the databse (in this case ?
    and ?), then converting them back for display. Clean: <cfset New_Text =
    #ReplaceList(TextChr(34),Chr(134))#> <cfset Fixed_Text =
    #ReplaceList(New_Text,Chr(39),Chr(139))#> Then input into the database. When
    retreiving, put it back: <cfset New_Text =
    #ReplaceList(Fixed_TextChr(134),Chr(34))#> <cfset Text =
    #ReplaceList(New_Text,Chr(139),Chr(39))#> It's just a workaround, but it works
    for me!!

    Tteddo Guest

  3. #3

    Default Re: problems with some characters in TEXTAREA

    Correct... just never forget to convert the input/output. I just found out that
    the single quote ' can be used instead of the double quote ". I'm not sure that
    this trick is working in all cases. So, replacing the double quote " to single
    quote ' has the advantage that there is no need to convert the output from the
    database.

    alpenman Guest

  4. #4

    Default Re: problems with some characters in TEXTAREA

    Yes, except when I did that, my users complained that they wanted their double
    quotes... Then they point to all kinds of sites that have them, then their eyes
    glaze over when I try to explain about databases!!

    Tteddo Guest

  5. #5

    Default Re: problems with some characters in TEXTAREA

    Thanks for the tip... do you have the same clients? :-)

    I'm using this one for the moment:
    <cfset Form.Remarks = #ReReplaceNoCase(Form.Remarks,Chr(34),Chr(39),"ALL ")#>
    alpenman Guest

  6. #6

    Default Re: problems with some characters in TEXTAREA

    It's good to see that clients are the same the world over!
    Tteddo Guest

  7. #7

    Default Re: problems with some characters in TEXTAREA

    Well, I can't really blame the users for not liking their data being changed.
    This
    could have serious impact, say, in a lawyer's office. The solution is fairly
    simple,
    just use:

    <input type="text" name="test" value="#HtmlEditFormat(SomeText)#">

    SomeText can contain any number of double or single quotes.


    OldCFer Guest

  8. #8

    Default Re: problems with some characters in TEXTAREA

    Does that restore the quotes on the way out also, or what's the function for that?
    That sounds like it would fix alot more text problems than just the quotes...
    Tteddo Guest

  9. #9

    Default Re: problems with some characters in TEXTAREA

    When you post a form field, all of the characters, quotes and all, will be
    inserted into the DB. The
    problem is when you set a variable in a form field all kind of weird things
    can happen with quotes
    etc.

    OldCFer Guest

Similar Threads

  1. Show first 25 characters or so of textarea
    By sattman in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: November 6th, 12:33 AM
  2. Problems: Weird /Odd characters with CF MX 6.1
    By SaikumarD in forum Coldfusion - Getting Started
    Replies: 3
    Last Post: June 6th, 04:56 PM
  3. Replies: 1
    Last Post: September 10th, 04:55 AM
  4. Textarea - Limit Amount of Characters?
    By Richard Hockey in forum PHP Development
    Replies: 2
    Last Post: August 23rd, 04:34 AM
  5. Is there a way to only allow a textarea to hold a certain # of characters?
    By mherchel webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: July 17th, 04:00 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139