Can anyone explain why this code is behaving like it is?
This stuff is driving me crazy! All day spent to get almost nowhere... Anyway...(deep breath)... Quick question: Does taking a number from a formfield and putting it into a session.cart.amount variable automatically turn it into a string variable? I'm sending a number from a formfield and in testing the amount from the formfield, I can multiply it, format it using DollarFormat, etc... behaves like a number should. But once the formfield variable is placed in the Session Query as session.cart.amount, it behaves like a string...I can't use DollarFormat...it returns an error that the variable session.cart.amount has to be a number...if I use DollarFormat(Val(session.cart.amount)), the value of the variable is 0...zero... it becomes a valueless string... I've haven't worked with the session-type queries created with Session.Cart = QueryNew etc., before and I guess I'm missing something...this should be simple stuff...but... If anyone has any suggestions about why this is going on, I'd be grateful for the help... Rick Excerpts from the code: The formfield: SELECT Name=S4x6 Class=TextInput01 Option Value=0 Selected0/Option Option Value=11/Option Option Value=22/Option Option Value=33/Option Option Value=44/Option Option Value=55/Option Option Value=66/Option Option Value=77/Option Option Value=88/Option Option Value=99/Option Option Value=1010/Option /SELECT Sent to another page for processing: CFLOCK Scope=Session Type=Exclusive TimeOut=5 CFSET Session.Total = 0 CFIF Form.S4x6 is not 0 CFSET Temp = QueryAddRow(Session.Cart) CFSET Temp = QuerySetCell(Session.Cart, PhotoFileName, CFOUTPUT#Form.PhotoFileName#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Quantity, CFOUTPUT#Form.S4x6#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Size, 4 x 6) CFSET Temp = QuerySetCell(Session.Cart, Amount, CFOUTPUT#Evaluate(Form.S4x6 * 3.95)#/CFOUTPUT) CFOUTPUT#DollarFormat(Session.Cart.Amount)#/CFOUTPUTbr -Note: CURRENTLY, ON THE LINE ABOVE, I GET THE FOLLOWING ERROR: Parameter 1 of function DollarFormat which is now 11.85 must be a number I've tried using Val to create a number out of what must be a string, but that will create a variable with a value of 0 (zero)... --- /CFIF CFLOOP Query=Session.Cart CFOUTPUT PhotoFileName: #PhotoFileName# Quantity: #Quantity# Size: #Size# Amount: #DollarFormat(Amount)# /CFOUTPUT CFOUTPUT#DollarFormat(Amount)#/CFOUTPUT CFSET Session.Total = Evaluate(Session.Total+Session.Cart.Amount) /CFLOOP brbr Order Total: CFOUTPUT#DollarFormat(Session.Cart.Amount)#/CFOUTPUT /CFLOCK ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137579 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Get the mailserver that powers this list at http://www.coolfusion.com
RE: Can anyone explain why this code is behaving like it is?
You are adding the string CFOUTPUT#Evaluate(Form.S4x6 * 3.95)#/CFOUTPUT as the value. Which will be something like: CFOUTPUT11.85/CFOUTPUT You probably just cant seen the CFOUTPUT tags in the browser because they are seen as tags. Change the code to this: CFSET Temp = QueryAddRow(Session.Cart) CFSET Temp = QuerySetCell(Session.Cart,PhotoFileName,Form.PhotoFileName) CFSET Temp = QuerySetCell(Session.Cart, Quantity,Form.S4x6) CFSET Temp = QuerySetCell(Session.Cart, Size, 4 x 6) CFSET Temp = QuerySetCell(Session.Cart, Amount,Evaluate(Form.S4x6 * 3.95)) And, i'd recommend reading up on your CF syntax. -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:39 PM To: CF-Talk Subject: Can anyone explain why this code is behaving like it is? This stuff is driving me crazy! All day spent to get almost nowhere... Anyway...(deep breath)... Excerpts from the code: The formfield: SELECT Name=S4x6 Class=TextInput01 Option Value=0 Selected0/Option Option Value=11/Option Option Value=22/Option Option Value=33/Option Option Value=44/Option Option Value=55/Option Option Value=66/Option Option Value=77/Option Option Value=88/Option Option Value=99/Option Option Value=1010/Option /SELECT Sent to another page for processing: CFLOCK Scope=Session Type=Exclusive TimeOut=5 CFSET Session.Total = 0 CFIF Form.S4x6 is not 0 CFSET Temp = QueryAddRow(Session.Cart) CFSET Temp = QuerySetCell(Session.Cart, PhotoFileName, CFOUTPUT#Form.PhotoFileName#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Quantity, CFOUTPUT#Form.S4x6#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Size, 4 x 6) CFSET Temp = QuerySetCell(Session.Cart, Amount, CFOUTPUT#Evaluate(Form.S4x6 * 3.95)#/CFOUTPUT) CFOUTPUT#DollarFormat(Session.Cart.Amount)#/CFOUTPUTbr ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137591 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
RE: Can anyone explain why this code is behaving like it is?
CFSET Temp = QuerySetCell(Session.Cart, Amount, CFOUTPUT#Evaluate(Form.S4x6 * 3.95)#/CFOUTPUT) Rick: What are the CFOUTPUT tags doing in your CFSET tag? Shouldn't this just be: CFSET Temp = QuerySetCell(Session.Cart, Amount, Evaluate(Form.S4x6 * 3.95)) My guess is that your SESSION.cart.amount variable is really equal to: CFOUTPUT11.85/CFOUTPUT and when that string gets spat out to the browser in the error message, your browser is hiding the CFOUTPUT tags because it assumes they are HTML tags that it is unfamiliar with. Check the HTML source code. -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:39 PM To: CF-Talk Subject: Can anyone explain why this code is behaving like it is? This stuff is driving me crazy! All day spent to get almost nowhere... Anyway...(deep breath)... Quick question: Does taking a number from a formfield and putting it into a session.cart.amount variable automatically turn it into a string variable? I'm sending a number from a formfield and in testing the amount from the formfield, I can multiply it, format it using DollarFormat, etc... behaves like a number should. But once the formfield variable is placed in the Session Query as session.cart.amount, it behaves like a string...I can't use DollarFormat...it returns an error that the variable session.cart.amount has to be a number...if I use DollarFormat(Val(session.cart.amount)), the value of the variable is 0...zero... it becomes a valueless string... I've haven't worked with the session-type queries created with Session.Cart = QueryNew etc., before and I guess I'm missing something...this should be simple stuff...but... If anyone has any suggestions about why this is going on, I'd be grateful for the help... Rick Excerpts from the code: The formfield: SELECT Name=S4x6 Class=TextInput01 Option Value=0 Selected0/Option Option Value=11/Option Option Value=22/Option Option Value=33/Option Option Value=44/Option Option Value=55/Option Option Value=66/Option Option Value=77/Option Option Value=88/Option Option Value=99/Option Option Value=1010/Option /SELECT Sent to another page for processing: CFLOCK Scope=Session Type=Exclusive TimeOut=5 CFSET Session.Total = 0 CFIF Form.S4x6 is not 0 CFSET Temp = QueryAddRow(Session.Cart) CFSET Temp = QuerySetCell(Session.Cart, PhotoFileName, CFOUTPUT#Form.PhotoFileName#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Quantity, CFOUTPUT#Form.S4x6#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Size, 4 x 6) CFSET Temp = QuerySetCell(Session.Cart, Amount, CFOUTPUT#Evaluate(Form.S4x6 * 3.95)#/CFOUTPUT) CFOUTPUT#DollarFormat(Session.Cart.Amount)#/CFOUTPUTbr -Note: CURRENTLY, ON THE LINE ABOVE, I GET THE FOLLOWING ERROR: Parameter 1 of function DollarFormat which is now 11.85 must be a number I've tried using Val to create a number out of what must be a string, but that will create a variable with a value of 0 (zero)... -- -- --- /CFIF CFLOOP Query=Session.Cart CFOUTPUT PhotoFileName: #PhotoFileName# Quantity: #Quantity# Size: #Size# Amount: #DollarFormat(Amount)# /CFOUTPUT CFOUTPUT#DollarFormat(Amount)#/CFOUTPUT CFSET Session.Total = Evaluate(Session.Total+Session.Cart.Amount) /CFLOOP brbr Order Total: CFOUTPUT#DollarFormat(Session.Cart.Amount)#/CFOUTPUT /CFLOCK ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137595 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Get the mailserver that powers this list at http://www.coolfusion.com
RE: Can anyone explain why this code is behaving like it is?
Hi, Mosh. Yes, the CFOUTPUT's were the problem...leaving them out solved the issue. Thanks for the tip... Rick -Original Message- From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 4:08 PM To: CF-Talk Subject: RE: Can anyone explain why this code is behaving like it is? CFSET Temp = QuerySetCell(Session.Cart, Amount, CFOUTPUT#Evaluate(Form.S4x6 * 3.95)#/CFOUTPUT) Rick: What are the CFOUTPUT tags doing in your CFSET tag? Shouldn't this just be: CFSET Temp = QuerySetCell(Session.Cart, Amount, Evaluate(Form.S4x6 * 3.95)) My guess is that your SESSION.cart.amount variable is really equal to: CFOUTPUT11.85/CFOUTPUT and when that string gets spat out to the browser in the error message, your browser is hiding the CFOUTPUT tags because it assumes they are HTML tags that it is unfamiliar with. Check the HTML source code. -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:39 PM To: CF-Talk Subject: Can anyone explain why this code is behaving like it is? This stuff is driving me crazy! All day spent to get almost nowhere... Anyway...(deep breath)... Quick question: Does taking a number from a formfield and putting it into a session.cart.amount variable automatically turn it into a string variable? I'm sending a number from a formfield and in testing the amount from the formfield, I can multiply it, format it using DollarFormat, etc... behaves like a number should. But once the formfield variable is placed in the Session Query as session.cart.amount, it behaves like a string...I can't use DollarFormat...it returns an error that the variable session.cart.amount has to be a number...if I use DollarFormat(Val(session.cart.amount)), the value of the variable is 0...zero... it becomes a valueless string... I've haven't worked with the session-type queries created with Session.Cart = QueryNew etc., before and I guess I'm missing something...this should be simple stuff...but... If anyone has any suggestions about why this is going on, I'd be grateful for the help... Rick Excerpts from the code: The formfield: SELECT Name=S4x6 Class=TextInput01 Option Value=0 Selected0/Option Option Value=11/Option Option Value=22/Option Option Value=33/Option Option Value=44/Option Option Value=55/Option Option Value=66/Option Option Value=77/Option Option Value=88/Option Option Value=99/Option Option Value=1010/Option /SELECT Sent to another page for processing: CFLOCK Scope=Session Type=Exclusive TimeOut=5 CFSET Session.Total = 0 CFIF Form.S4x6 is not 0 CFSET Temp = QueryAddRow(Session.Cart) CFSET Temp = QuerySetCell(Session.Cart, PhotoFileName, CFOUTPUT#Form.PhotoFileName#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Quantity, CFOUTPUT#Form.S4x6#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Size, 4 x 6) CFSET Temp = QuerySetCell(Session.Cart, Amount, CFOUTPUT#Evaluate(Form.S4x6 * 3.95)#/CFOUTPUT) CFOUTPUT#DollarFormat(Session.Cart.Amount)#/CFOUTPUTbr -Note: CURRENTLY, ON THE LINE ABOVE, I GET THE FOLLOWING ERROR: Parameter 1 of function DollarFormat which is now 11.85 must be a number I've tried using Val to create a number out of what must be a string, but that will create a variable with a value of 0 (zero)... -- -- --- /CFIF CFLOOP Query=Session.Cart CFOUTPUT PhotoFileName: #PhotoFileName# Quantity: #Quantity# Size: #Size# Amount: #DollarFormat(Amount)# /CFOUTPUT CFOUTPUT#DollarFormat(Amount)#/CFOUTPUT CFSET Session.Total = Evaluate(Session.Total+Session.Cart.Amount) /CFLOOP brbr
RE: Can anyone explain why this code is behaving like it is?
Thanks, Ryan... The CFOUTPUT's were causing the problem. I guess I just had it in my head that the variables would not be processed correctly without the CFOUTPUT's there. Never thought to take them out...I guess it's kinda like #'s: For so many of us it's the more the merrier! Oh, well...live and learn. And, yes, I do read up on the syntax quite a bit...I had my nose in a book all day trying to sort out the issue...but sometimes you just can't find what you need without experiencing it... and with help from friends... Thanks, Rick -Original Message- From: Ryan Emerle [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 4:00 PM To: CF-Talk Subject: RE: Can anyone explain why this code is behaving like it is? You are adding the string CFOUTPUT#Evaluate(Form.S4x6 * 3.95)#/CFOUTPUT as the value. Which will be something like: CFOUTPUT11.85/CFOUTPUT You probably just cant seen the CFOUTPUT tags in the browser because they are seen as tags. Change the code to this: CFSET Temp = QueryAddRow(Session.Cart) CFSET Temp = QuerySetCell(Session.Cart,PhotoFileName,Form.PhotoFileName) CFSET Temp = QuerySetCell(Session.Cart, Quantity,Form.S4x6) CFSET Temp = QuerySetCell(Session.Cart, Size, 4 x 6) CFSET Temp = QuerySetCell(Session.Cart, Amount,Evaluate(Form.S4x6 * 3.95)) And, i'd recommend reading up on your CF syntax. -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:39 PM To: CF-Talk Subject: Can anyone explain why this code is behaving like it is? This stuff is driving me crazy! All day spent to get almost nowhere... Anyway...(deep breath)... Excerpts from the code: The formfield: SELECT Name=S4x6 Class=TextInput01 Option Value=0 Selected0/Option Option Value=11/Option Option Value=22/Option Option Value=33/Option Option Value=44/Option Option Value=55/Option Option Value=66/Option Option Value=77/Option Option Value=88/Option Option Value=99/Option Option Value=1010/Option /SELECT Sent to another page for processing: CFLOCK Scope=Session Type=Exclusive TimeOut=5 CFSET Session.Total = 0 CFIF Form.S4x6 is not 0 CFSET Temp = QueryAddRow(Session.Cart) CFSET Temp = QuerySetCell(Session.Cart, PhotoFileName, CFOUTPUT#Form.PhotoFileName#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Quantity, CFOUTPUT#Form.S4x6#/CFOUTPUT) CFSET Temp = QuerySetCell(Session.Cart, Size, 4 x 6) CFSET Temp = QuerySetCell(Session.Cart, Amount, CFOUTPUT#Evaluate(Form.S4x6 * 3.95)#/CFOUTPUT) CFOUTPUT#DollarFormat(Session.Cart.Amount)#/CFOUTPUTbr ~ | Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137591 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=708.628.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137629 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Get the mailserver that powers this list at http://www.coolfusion.com
AW: Can anyone explain this?
Hi, if you manually pass the values for CFID and CFTOKEN from page to page (or enable cookies), they won't change anymore and indeed CF stores these values and along with them stores all session variables for that user. Whenever the user tries to access a session variable, CF looks up the users CFID and CFTOKEN in server memory and retrieves the associated session var. HTH, Chris -Ursprüngliche Nachricht- Von: sebastian palmigiani [mailto:[EMAIL PROTECTED]] Gesendet: Samstag, 27. Januar 2001 05:52 An: CF-Talk Betreff: Re: Can anyone explain this? Do these "session cookies" help to connect session variables with a particular user? I don't see how as their values change from page to page. What is the purpose of these "session cookies?" Sebastian on 1/26/01 9:43 PM, David E. Crawford at [EMAIL PROTECTED] wrote: These are "session cookies", which are not written to the "cookie" file, but exist in memory, but not necessarily between pages. DC - Original Message - From: "sebastian palmigiani" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Friday, January 26, 2001 22:31 Subject: Can anyone explain this? Can anyone explain this? I have cookies disabled. I have session management and setclientcookies set to yes in application.cfm. I am using CF 4.0 On each page I put the following code: cfoutput#cookie.cfid#br#cookie.cftoken#/cfoutput There are no cookies listed in the Parameters CGI variables of each page. And yet for each page I get a different value for cfid which increments by one and a different value for cftoken. Sebastian ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Can anyone explain this?
Just a guess, but.. You are using a CFAPPLICATION tag, correct? 1. CFAPPLICATION sets up the two cookies (CFID, CFTOKEN) and sends them to the browser. 2. Your browser isn't allowing cookies. 3.Browser hits page, CFAPPLICATION tag runs, it looks for the CFID / CFTOKEN cookies. They don't exist, so it creates them. 4.The cookies are available during the execution of the current page. 5. Cookies don't get set to the browser. Not as temporary cookies, not as permanent. 6. Click to next page and start again at number 1. Anyone want to verify? sebastian palmigiani wrote: Can anyone explain this? I have cookies disabled. I have session management and setclientcookies set to yes in application.cfm. I am using CF 4.0 On each page I put the following code: cfoutput#cookie.cfid#br#cookie.cftoken#/cfoutput There are no cookies listed in the Parameters CGI variables of each page. And yet for each page I get a different value for cfid which increments by one and a different value for cftoken. Sebastian ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Can anyone explain this?
These are "session cookies", which are not written to the "cookie" file, but exist in memory, but not necessarily between pages. DC - Original Message - From: "sebastian palmigiani" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Friday, January 26, 2001 22:31 Subject: Can anyone explain this? Can anyone explain this? I have cookies disabled. I have session management and setclientcookies set to yes in application.cfm. I am using CF 4.0 On each page I put the following code: cfoutput#cookie.cfid#br#cookie.cftoken#/cfoutput There are no cookies listed in the Parameters CGI variables of each page. And yet for each page I get a different value for cfid which increments by one and a different value for cftoken. Sebastian ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Can anyone explain this?
Sebastian, Since you have cookies disabled, each time you load page, ColdFusion assigns a new CFID/CFTOKEN. If it was able to store those values in a cookie, when you loaded the next page, CF would see that you've already got a set of tokens assigned to you, and just use those. The high and low of it is that you'll have to pass the CFID and CFTOKEN around in the URL and set them for each page, else you'll be doomed to no session management through ColdFusion. Hope This Helps, Eron -Original Message- From: sebastian palmigiani [mailto:[EMAIL PROTECTED]] Sent: Friday, January 26, 2001 10:31 PM To: CF-Talk Subject: Can anyone explain this? Can anyone explain this? I have cookies disabled. I have session management and setclientcookies set to yes in application.cfm. I am using CF 4.0 On each page I put the following code: cfoutput#cookie.cfid#br#cookie.cftoken#/cfoutput There are no cookies listed in the Parameters CGI variables of each page. And yet for each page I get a different value for cfid which increments by one and a different value for cftoken. Sebastian ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Can anyone explain this?
Do these "session cookies" help to connect session variables with a particular user? I don't see how as their values change from page to page. What is the purpose of these "session cookies?" Sebastian on 1/26/01 9:43 PM, David E. Crawford at [EMAIL PROTECTED] wrote: These are "session cookies", which are not written to the "cookie" file, but exist in memory, but not necessarily between pages. DC - Original Message - From: "sebastian palmigiani" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Friday, January 26, 2001 22:31 Subject: Can anyone explain this? Can anyone explain this? I have cookies disabled. I have session management and setclientcookies set to yes in application.cfm. I am using CF 4.0 On each page I put the following code: cfoutput#cookie.cfid#br#cookie.cftoken#/cfoutput There are no cookies listed in the Parameters CGI variables of each page. And yet for each page I get a different value for cfid which increments by one and a different value for cftoken. Sebastian ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists