I'd probably use arrays on your action page...

<cfparam name="form.checkbox" type="string" default="">
<cfif len(trim(form.checkbox))>
        <cfset checkboxes = listtoarray(form.checkbox)>
        <cfloop index="x" from="1" to="#arraylen(checkboxes)#">
                <cfset checkboxes[x] = listtoarray(checkboxes[x],"&")>
        </cfloop>
</cfif>

At this point, you should be able to reference all your territory_id's with
something like checkboxes[idx][1] and all your old_terr_id's with something
like checkboxes[idx][2] where idx is your own local variable. Your
checkboxes array will contain one array with 2 elements for each checkbox
the user selects.

hth

S. Isaac Dealey
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

> 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
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to