I think what you want <CFSET Grp=(form.adult + form.children)>.  (no quotes)

~Simon

> Simon Horwith
> Allaire Certified ColdFusion Instructor
> Certified ColdFusion Developer
> Fig Leaf Software
> 1400 16th St NW, # 220
> Washington DC 20036
> 202.797.6570 (direct line)
> www.figleaf.com
> 


-----Original Message-----
From: Steve Doran [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 18, 2001 8:36 AM
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to