Ask a Question related to Macromedia ColdFusion, Design and Development.
-
ErinT #1
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
-
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... -
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. ... -
#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: ... -
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,... -
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 -
ErinT #2
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
-
Stressed_Simon #3
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
-
ErinT #4
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
-
mkane1 #5
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



Reply With Quote

