Help - Extra Characters

Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default Help - Extra Characters

    :confused;

    Hi. I'm a painfully inexperienced person that has recently been handed the
    task of creating a database and a web interface to work with it. It's going
    pretty well, and I like cold fusion. However, I have a problem I can't seem to
    figure out.

    I've created a dozen forms that all seem to be working fine, except one. I
    have one field, on one page, that adds blank characters each time the page is
    brought up, evenutally causing the field to hit it's character max in the
    database and generating truncation errors. I can't figure out why it's doing
    it. If anyone can help, that would be great. i tried, as a temporary fix,
    using the trim() function to remove extra characters,and it's helping, but I'm
    still ending up with 22 blank characters in the field. If anyone can tell me
    what's wrong, I'd be forever greatful....

    Here's the code for the form field.
    <textarea name="ChannelsAffected" cols="50" rows="2" onkeyup="update();" >
    <cfif isdefined
    ('form.channelsaffected')><cfoutput>#trim(form.cha nnelsaffected)#</cfoutput>
    <cfelse><cfif
    isDefined('channels.channelsaffected')><cfoutput># trim(channels.channelsaffected
    )#</cfoutput></cfif>
    </cfif>
    </textarea>

    and here is the code that inserts it into the database:

    <cfif (IsDefined ("Form.ChannelsAffected") AND #trim(Form.ChannelsAffected)#
    NEQ "")>
    <cfif channels.recordcount GT 0>
    <cfquery datasource="#KBDB#" username="#KBUSER#" password="#KBPW#">
    Update bullpenrca set ChannelsAffected=
    '#trim(Form.ChannelsAffected)#'
    where bullpenlogid=#form.bullpenlogid#
    </cfquery>
    <cfelse>
    <cfquery datasource="#KBDB#" username="#KBUSER#" password="#KBPW#">
    INSERT INTO bullpenrca (BullpenLogID, ChannelsAffected, Employee) VALUES
    (
    <cfif IsDefined("FORM.BullpenLogID") AND #FORM.BullpenLogID# NEQ "">
    '#CurrentID#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.ChannelsAffected")>
    '#trim(FORM.ChannelsAffected)#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.Name") AND #FORM.Name# NEQ "">
    '#form.Name#'
    <cfelse>
    NULL
    </cfif>
    )
    </cfquery>
    </cfif>

    ErinT Guest

  2. Similar Questions and Discussions

    1. extra characters in XML export
      Every time I export to XML, my line breaks turn into square shaped characters in the XML. When I open this up in a text editor it translates these...
    2. ReadLine extra characters "|"
      I'm trying to read from a text file on a PC and when I use ReadLine I get extra "|" characters at the beginning (and sometimes the end) of lines. ...
    3. #25160 [NEW]: Extra characters in header under certain conditions
      From: jeff at mos dot org Operating system: Windows 2000 PHP version: 4.3.2 PHP Bug Type: IIS related Bug description: ...
    4. how to read japanese characters (multilingual characters) from a text file and save them in Access database ???
      HI All i m trying to read a text file, having some japanese characters and saved as UTF-8 encoding. I m using ASP,FSO ... my code is below,...
    5. Numeric characters after alphabetic characters sorting varchar2 fields
      Hi! Why numeric characters are placed after alphabetic characters sorting varchar2 fields? Example: AAA BBB 111 FFF XXX
  3. #2

    Default Help - Extra Characters

    :confused;

    Hi. I'm a painfully inexperienced person that has recently been handed the
    task of creating a database and a web interface to work with it. It's going
    pretty well, and I like cold fusion. However, I have a problem I can't seem to
    figure out.

    I've created a dozen forms that all seem to be working fine, except one. I
    have one field, on one page, that adds blank characters each time the page is
    brought up, evenutally causing the field to hit it's character max in the
    database and generating truncation errors. I can't figure out why it's doing
    it. If anyone can help, that would be great. i tried, as a temporary fix,
    using the trim() function to remove extra characters,and it's helping, but I'm
    still ending up with 22 blank characters in the field. If anyone can tell me
    what's wrong, I'd be forever greatful....



    Here's the code for the form field.
    <textarea name="ChannelsAffected" cols="50" rows="2" onkeyup="update();" >
    <cfif isdefined
    ('form.channelsaffected')><cfoutput>#trim(form.cha nnelsaffected)#</cfoutput>
    <cfelse><cfif
    isDefined('channels.channelsaffected')><cfoutput># trim(channels.channelsaffected
    )#</cfoutput></cfif>
    </cfif>
    </textarea>

    and here is the code that inserts it into the database:

    <cfif (IsDefined ("Form.ChannelsAffected") AND #trim(Form.ChannelsAffected)#
    NEQ "")>
    <cfif channels.recordcount GT 0>
    <cfquery datasource="#KBDB#" username="#KBUSER#" password="#KBPW#">
    Update bullpenrca set ChannelsAffected=
    '#trim(Form.ChannelsAffected)#'
    where bullpenlogid=#form.bullpenlogid#
    </cfquery>
    <cfelse>
    <cfquery datasource="#KBDB#" username="#KBUSER#" password="#KBPW#">
    INSERT INTO bullpenrca (BullpenLogID, ChannelsAffected, Employee) VALUES
    (
    <cfif IsDefined("FORM.BullpenLogID") AND #FORM.BullpenLogID# NEQ "">
    '#CurrentID#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.ChannelsAffected")>
    '#trim(FORM.ChannelsAffected)#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.Name") AND #FORM.Name# NEQ "">
    '#form.Name#'
    <cfelse>
    NULL
    </cfif>
    )
    </cfquery>
    </cfif>

    ErinT Guest

  4. #3

    Default Re: Help - Extra Characters

    All the cfifs you are using in your text area leave blank spaces once they are
    removed by the CF Administrator.

    The easiest way to prevent this is to take the cfifs to outside the textarea
    and then set a varaiable dependent on what you want and then output the
    variable.

    Like this:-

    <cfset TextContent = "">
    <cfif isdefined ('form.channelsaffected')>
    <cfset TextContent = trim(form.channelsaffected)>
    <cfelse>
    <cfif isDefined('channels.channelsaffected')>
    <cfset TextContent = trim(channels.channelsaffected)>
    </cfif>
    </cfif>


    <textarea name="ChannelsAffected" cols="50" rows="2" onkeyup="update();"
    ><cfoutput>#Trim(TextContent)#</cfoutput></textarea>
    Stressed_Simon Guest

  5. #4

    Default Re: Help - Extra Characters

    thank you so much! i'm going to give this a try, and i'll come back and let you know what happens. I REALLY appreciate the response!!!!!!!!!
    ErinT Guest

  6. #5

    Default Re: Help - Extra Characters

    Anything you put between the opening textarea and closing /textarea will appear
    in the box. Including spaces. I can't tell if you have spaces or TAB characters
    in front of your cfif statements in that area, but I suspect that is where the
    unwanted spaces are coming from.

    I suggest that you determine what value should appear in the box before the
    textarea statement. One suggestion would be to create an exmpty variable, set
    to blank, i.e. cfset channelsaffectedval = "" and then using your cfifs set it
    to either the form or query value. Then after the opening textarea just output
    the channelsaffectedval

    I also recommend putting the cfoutput tags outside of the texarea, and not
    inside.

    Finally, I would look at what the update() javascript function does. By
    calling it in the onkeyup event, every time the user releases a key press while
    in that box, the function is called. If it writes back to the value, it may be
    adding spaces.

    mkane1 Guest

Posting Permissions

  • You may not post new threads
  • You may 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