You want this:
<CFSET Grp = form.adult + form.children>
When setting quotes around it, CF assumes it's a string.
rgds
* Holger Lockertsen, Solutions Developer
* Pixelduck AS - Nedre Slottsgate 5, N-0157 OSLO, Noreg/Norway
* 23 31 03 04 / 91 83 20 51
* [EMAIL PROTECTED]
* http://www.pixelduck.com/
> -----Original Message-----
> From: Steve Doran [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 18, 2001 2:36 PM
> To: CF-Talk
> Subject: string to number
>
>
> I am trying to get a variable to work that would tell me how
> many rooms a
> person would need if they has X amount of people in their party.
>
> Here is the Code I am working with:
>
> <CFSET Grp=("form.adult + form.children")>
>
> <CFSET SmRmRq=0>
>
> <CFIF Grp LTE 4>
> <CFSET SmRmRq=1>
> <CFELSEIF (Grp GTE 5) and (Grp LTE 8)>
> <CFSET SmRmRq=2>
> <CFELSEIF (Grp GTE 9) and (Grp LTE 12)>
> <CFSET SmRmRq=3>
> <CFELSEIF (Grp GTE 13) and (Grp LTE 16)>
> <CFSET SmRmRq=4>
> <CFELSEIF (Grp GTE 17) and (Grp LTE 20)>
> <CFSET SmRmRq=5>
> <CFELSEIF (Grp GTE 21) and (Grp LTE 24)>
> <CFSET SmRmRq=6>
> <CFELSEIF (Grp GTE 25) and (Grp LTE 28)>
> <CFSET SmRmRq=7>
> <CFELSEIF Grp GTE 29>
> <CFSET SmRmRq=8>
> </CFIF>
>
> The problem I am having is when you output grp it gives you
> the total of
> form.adult + form.children. But when you use grp to set the variable
> SmRmRq it goes to a string "number + number" and will not accurately
> convert the variable.
>
> Is there a way to change the grp to a number? In Javascript
> It would be
> something like Var = (parseInt(form.adult) + parseInt(form.children))
>
> Thanks in advance for any assistance,
>
> Steve Doran :)
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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