Mike,

I have been researching what list function to use and this looks great!
However, I don't know how many checkboxes the end-user will select. How can
I modify this code to accommodate for flexibility? Is a CFLOOP List Loop the
answer?

 <cfloop index = "i" list = "#variables.testVar#" delimiters = ",">

-- Lisa

-----Original Message-----
From: Michael Corbridge [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 15, 2002 12:18 PM
To: CF-Talk
Subject: RE: Dynamic checkboxes and the resultant page.


try this:

<cfset variables.testVar = "102310&OLD=QQQ100,202301&OLD=QQQ200">

<cfset variables.nvPair1 = listGetAt(variables.testVar,1)>
<cfset variables.nvPair2 = listGetAt(variables.testVar,2)>

<cfset variables.var1=listGetAt(variables.nvPair1,1,"&")>
<cfset
variables.whereVar1=replace(listGetAt(variables.nvPair1,2,"&"),"OLD=","")>

<cfoutput>
#variables.var1#
#variables.whereVar1#
</cfoutput>

<cfset variables.var2=listGetAt(variables.nvPair2,1,"&")>
<cfset
variables.whereVar2=replace(listGetAt(variables.nvPair2,2,"&"),"OLD=","")>

<cfoutput>
#variables.var2#
#variables.whereVar2#
</cfoutput>

hth,

- mike

-----Original Message-----
From: Greenberg, Lisa [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 15, 2002 2:52 PM
To: CF-Talk
Subject: Dynamic checkboxes and the resultant page.


I am trying to create dynamic checkboxes from a query result set and then
pass a parameter as well to the resultant page:
 
  <cfform action="checkout.cfm" name="alignNewCustomer" method="POST"
enablecab="Yes">
     <cfoutput query="QQQSearch">
      <tr>
         <td>#old_terr_id#</td>
         <td>
            <cfinput type="checkbox"  name="checkbox"
value="#QQQSearch.territory_id#&OLD=#old_terr_id#"
align="LEFT">#territory_name#
         </td>
      </tr></cfoutput>
  </cfform>
 
  On the action page I have the following if a checkbox has been entered:
 
  <cfoutput>value: #form.checkbox#</cfoutput> 
 
  which results in something like this when 2 boxes are checked:
 
         102310&OLD=QQQ100,202301&OLD=QQQ200  
 
  How do I parse this form variable's value(s) to set  local variables to
the values passed?  For example,
 
        
 <cfset variables.var1='102310'>
 <cfset variables.whereVar1='QQQ100'> 
 
 <cfset variables.var2='202310'>
<cfset variables.whereVar2='QQQ200'>
 
If there is more efficient method to generating dynamic checkboxes and
obtaining their values I'm all ears!.
 
-- Lisa
 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to