I have a user list where the users could 'belong' to any or all U.S.
States.  When the user goes in to edit their profile, they are presented
with a qforms container to select the states.

I just hacked out the code below.  I'll bet there's a more elegant way
to do this but I just wrote what you see and moved on.  I removed most
of the U.S. states from this code block given its size.

Hope this helps,

--------------------------------------------
 Matt Robertson       [EMAIL PROTECTED] 
 MSB Designs, Inc.  http://mysecretbase.com
--------------------------------------------

<cfquery 
        name="GetChosenStates" 
        datasource="#mydsnhere#">
        SELECT 
                cm_users_states.State
        FROM cm_users_states
        WHERE 
                cm_users_states.ParentID=<cfqueryparam
cfsqltype="CF_SQL_VARCHAR" value=#myuseridhere#>
</cfquery>
<cfset variables.ChosenList="">
<cfloop query="GetChosenStates">
        <cfset
variables.ChosenList=ListAppend(variables.ChosenList,GetChosenStates.Sta
te)>
</cfloop>
<table 
        border="0" 
        cellpadding="4" 
        cellspacing="0"
        style="border: 1px inset;" 
        align="center">
<tr>
        <td class="FormBody" align="center" colspan="3">
        In what U.S. states do you operate in?<span style="color:
##DC143C"><b>*</b></span>
        </td>
</tr>
<tr>
        <td class="FormBody" align="center">
        Available States:<BR>
        <select 
                name="States" 
                size="8" 
                multiple 
                style="width: 175px;" 
                onDblClick="objForm.States.transferTo('ChosenStates');"
                <cfif variables.NNVer GTE 5>class="formfield"</cfif>>>
                <cfif not
ListContains(variables.ChosenList,"AK")><option value="AK">Alaska</cfif>

                <cfif not
ListContains(variables.ChosenList,"AL")><option
value="AL">Alabama</cfif>
                <cfif not
ListContains(variables.ChosenList,"AR")><option
value="AR">Arkansas</cfif>
                <cfif not
ListContains(variables.ChosenList,"AZ")><option
value="AZ">Arizona</cfif>
        </select>
        </td>
        <td width="50" align="Center" valign="Middle">
        <img src="shim.gif" width="1" height="10" alt="" border="0"><br>
        <input 
                type="Button" 
                value="&gt;&gt;" 
                onClick="objForm.States.transferTo('ChosenStates', true,
'all');" 
                style="width: 30px;"
                <cfif variables.NNVer GTE
5>class="tinysubmitbutton"</cfif>>
        <br><input 
                type="Button" 
                value="&gt;"
onClick="objForm.States.transferTo('ChosenStates');" 
                style="width: 30px;"
                <cfif variables.NNVer GTE
5>class="tinysubmitbutton"</cfif>>
        <br><input 
                type="Button" 
                value="&lt;" 
                onClick="objForm.States.transferFrom('ChosenStates');" 
                style="width: 30px;"
                <cfif variables.NNVer GTE
5>class="tinysubmitbutton"</cfif>>
        <br><input 
                type="Button" 
                value="&lt;&lt;" 
                onClick="objForm.States.transferFrom('ChosenStates',
true, 'all');" 
                style="width: 30px;"
                <cfif variables.NNVer GTE
5>class="tinysubmitbutton"</cfif>>
                <br><img src="shim.gif" width="1" height="10" alt=""
border="0"><br>
        </td>
        <td align="center" valign="Top" class="FormBody">
        Chosen States:<BR>
        <select 
                name="ChosenStates" 
                size="8" 
                multiple 
                style="width: 175px;" 
        
onDblClick="objForm.States.transferFrom('ChosenStates');"
                <cfif variables.NNVer GTE 5>class="formfield"</cfif>>>
                <cfloop query="GetChosenStates">
                        <cfswitch expression="#GetChosenStates.State#">
                                <cfcase value="AK"><option
value="AK">Alaska</cfcase>
                                <cfcase value="AL"><option
value="AL">Alabama</cfcase>
                                <cfcase value="AR"><option
value="AR">Arkansas</cfcase>
                                <cfcase value="AZ"><option
value="AZ">Arizona</cfcase>
                        </cfswitch>
                </cfloop>
        </select>
        </td>
</tr>
<tr>
<td align="center" colspan="3">
<input 
        type="image" 
        src="../images/submit.gif" 
        name="signup" 
        border="0">
</td>
</tr>
</table>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

Reply via email to