Hey all, Raymond was kind enough to sit and help me over Yahoo Messenger for some time last night. It was an unfuriating problem which I just couldn't get a handle on, and would have never solved without Raymond's help.
The purpose of the script was to pop up a form that would allow a user to search for an ordernumber, display a list of those order numbers and when the user clicks a button marked SELECT, it would set the field value on the main form to that ordernumber and the corresponding Order Description. In order to set a field on the main form, of course I had to use Javascript. <INPUT TYPE = "button" VALUE = "Select" onClick = "SelectThis(#SAP_IO_NBR#,'#JSStringFormat(SAP_IO_DESC)#')"></TD> This is what we were using initially, and what should have worked. The description field as I posted before, had all sorts of special characters in it that repeatedly caused Unterminated String Constant errors, Truncated this and that and Obfuscated knickknacks to occur. These resulted from the problem that Raymond described below. What we had to do to fix this was: <INPUT TYPE = "button" VALUE = "Select" onClick = "SelectThis(#SAP_IO_NBR#,'#JSStringFormat(Replace(SAP_IO_DESC,"""","&quo te;","ALL"))#')"></TD> See the Replace Function now included in the JSStringFormat piece? Right. That...does stuff..that replaces the bad things in the string with good things and it all works now. *nods rapidly* Ciao! -Gel ========================== "As of tomorrow, employees will only be able to access the building using individual security cards. Pictures will be taken next Wednesday and employees will receive their cards in two weeks." (This was the winning quote from Fred Dales at Microsoft Corp in Redmond, WA.) ========================== ICQ: 607953 YAHOO thingy: Gel2.rm -----Original Message----- From: Raymond Camden [mailto:[EMAIL PROTECTED]] For those who are curious: I worked with Gel a bit on this, and the problem was this. Gel was using code like so: <.... onClick="FOO"> Now, Foo is where crap gets fun. Like CF, JavaScript wants you to use either double quotes or single quotes. If you use double quotes, and need quotes on the inside, you should try to use single quotes, or escapes quotes (in CF, this is "", in JS, \"). Ok, so, let's look at what he had for FOO: SelectThis(#somenum#,'#somestr#') So, when he first had errors, I told him to wrap somestr with JSStringFormat. This did what you would expect. It changed ' to \' and " to \" Ok, here is where it's odd. Because we had double quotes on the outside (onClick=""), the browser itself got confused by the escaped double quote. So, it was legal syntax, but still threw an error. Um, I'm not sure if that made sense, but, for a good read on it, see: http://groups.google.com/groups?hl=en&rnum=10&selm=831ito%24f37%241%40bg tnsc03.worldnet.att.net And, let me say again, I _love_ Google. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
