Problem with \ in a Javascript/Query
I have a page that populates a combo box via javascript. The data that is returned from a query is (quotes included) \\somemachine\somedir\some.exe. The Javascript sets the value via the code new Option('\\somemachine\somedir\some.exe','\\somemachine\somedir\some.exe' ) (that's the double quotes within single quotes if it's not too clear). The problem is, it translates out to \somemachine omedirsome.exe (the somedirectory begins with a t, so I'm thinking that it's translating it to a tab character). When I pass the selection to another page, it passes the tab and the formatting as translated, what I need is for the slashes and characters to be passed as that are in the DB. Is there anything I can do with regex or something to keep the slashes the way they are? Kind of like PreserveSingleQuotes. TIA, Rob Edwards Phone: (502) 359-1627 Systems Management Tools Pager: (502) 478-1116 United Parcel Service Fax:(502) 359-0094 EMail: [EMAIL PROTECTED] (2B || !2B) == ? __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Problem with \ in a Javascript/Query
In JS, the \ is the escape character, so (i think) if you just do some sort of replace to double-up all the slashes so it comes out in the js code as: somemachine\\somedir\\some.exe [EMAIL PROTECTED] 08/22/02 09:28AM I have a page that populates a combo box via javascript. The data that is returned from a query is (quotes included) \\somemachine\somedir\some.exe. The Javascript sets the value via the code new Option('\\somemachine\somedir\some.exe','\\somemachine\somedir\some.exe' ) (that's the double quotes within single quotes if it's not too clear). The problem is, it translates out to \somemachine omedirsome.exe (the somedirectory begins with a t, so I'm thinking that it's translating it to a tab character). When I pass the selection to another page, it passes the tab and the formatting as translated, what I need is for the slashes and characters to be passed as that are in the DB. Is there anything I can do with regex or something to keep the slashes the way they are? Kind of like PreserveSingleQuotes. TIA, Rob Edwards Phone: (502) 359-1627 Systems Management Tools Pager: (502) 478-1116 United Parcel Service Fax:(502) 359-0094 EMail: [EMAIL PROTECTED] (2B || !2B) == ? __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Problem with \ in a Javascript/Query
Javascript will see the \ as an escape sequence -- if you double up the \, then it should retain it: A simple replace should do it: cfset tmpFile = \\somemachine\somedir\some.exe cfset tmpFile = Replace( tmpFile,\,\\,all) - Original Message - From: Edwards Robert (air0rae) [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, August 22, 2002 9:28 AM Subject: Problem with \ in a Javascript/Query I have a page that populates a combo box via javascript. The data that is returned from a query is (quotes included) \\somemachine\somedir\some.exe. The Javascript sets the value via the code new Option('\\somemachine\somedir\some.exe','\\somemachine\somedir\some.exe' ) (that's the double quotes within single quotes if it's not too clear). The problem is, it translates out to \somemachine omedirsome.exe (the somedirectory begins with a t, so I'm thinking that it's translating it to a tab character). When I pass the selection to another page, it passes the tab and the formatting as translated, what I need is for the slashes and characters to be passed as that are in the DB. Is there anything I can do with regex or something to keep the slashes the way they are? Kind of like PreserveSingleQuotes. TIA, Rob Edwards Phone: (502) 359-1627 Systems Management Tools Pager: (502) 478-1116 United Parcel Service Fax: (502) 359-0094 EMail: [EMAIL PROTECTED] (2B || !2B) == ? __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Problem with \ in a Javascript/Query
I kind of figured that. I forgot about the replace function and was trying to figure out how to do it with RegEx. Leave it to me to try to put a square peg in a round hole. Rob Edwards Phone: (502) 359-1627 Systems Management Tools Pager: (502) 478-1116 United Parcel Service Fax:(502) 359-0094 EMail: [EMAIL PROTECTED] (2B || !2B) == ? -Original Message- From: BEN MORRIS [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 9:46 AM To: CF-Talk Subject: Re: Problem with \ in a Javascript/Query In JS, the \ is the escape character, so (i think) if you just do some sort of replace to double-up all the slashes so it comes out in the js code as: somemachine\\somedir\\some.exe [EMAIL PROTECTED] 08/22/02 09:28AM I have a page that populates a combo box via javascript. The data that is returned from a query is (quotes included) \\somemachine\somedir\some.exe. The Javascript sets the value via the code new Option('\\somemachine\somedir\some.exe','\\somemachine\somedir\some.exe' ) (that's the double quotes within single quotes if it's not too clear). The problem is, it translates out to \somemachine omedirsome.exe (the somedirectory begins with a t, so I'm thinking that it's translating it to a tab character). When I pass the selection to another page, it passes the tab and the formatting as translated, what I need is for the slashes and characters to be passed as that are in the DB. Is there anything I can do with regex or something to keep the slashes the way they are? Kind of like PreserveSingleQuotes. TIA, Rob Edwards Phone: (502) 359-1627 Systems Management Tools Pager: (502) 478-1116 United Parcel Service Fax:(502) 359-0094 EMail: [EMAIL PROTECTED] (2B || !2B) == ? __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Problem with \ in a Javascript/Query
You can use the jsStringFormat() function to escape any special JS characters. -Original Message- From: Edwards Robert (air0rae) [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 7:28 AM To: CF-Talk Subject: Problem with \ in a Javascript/Query I have a page that populates a combo box via javascript. The data that is returned from a query is (quotes included) \\somemachine\somedir\some.exe. The Javascript sets the value via the code new Option('\\somemachine\somedir\some.exe','\\somemachine\somedir\ some.exe' ) (that's the double quotes within single quotes if it's not too clear). The problem is, it translates out to \somemachine omedirsome.exe (the somedirectory begins with a t, so I'm thinking that it's translating it to a tab character). When I pass the selection to another page, it passes the tab and the formatting as translated, what I need is for the slashes and characters to be passed as that are in the DB. Is there anything I can do with regex or something to keep the slashes the way they are? Kind of like PreserveSingleQuotes. TIA, Rob Edwards Phone: (502) 359-1627 Systems Management Tools Pager: (502) 478-1116 United Parcel Service Fax:(502) 359-0094 EMail:[EMAIL PROTECTED] (2B || !2B) == ? __ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists