Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2005



Tip: Looking for answers? Try searching our database.

Multiple Select in Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tdecoste - 30 Sep 2005 20:12 GMT
I have three db's 1)rep 2)Plant 3)RepPlant.  A rep can cover mulitple plants,
hence the select multiple.  I am haveing trouble displaying their plants in the
"Change" form.  Once I can get that to work my goal is to delete existing
records From the RepPlant and replace with what ever has changed.  Abreviated
code below. I know its messed up, but I cannot seem to get it to work.

<tr valign="baseline">
        <td align="left" nowrap><a href="Add_plant.cfm">Plant</a>:</td>
        <td align="left" nowrap> <select name="plantid" size="10" multiple
tabindex="7">
              <cfoutput query="rsplant">
              <option value="#rsplant.plantID#"> <cfif
(isDefined("rsPlant.plantid"))><cfloop query="rsRepPlant"></cfloop>
selected></cfif></option>
            </cfoutput> </select></td>
      </tr>
mxstu - 30 Sep 2005 20:25 GMT
1) Add a cfquery called "rsRepPlant" that retrieves all of the "plantID's" for
the selected "repID".
SELECT plantID FROM RepPlant WHERE repID = #selectedRepID#
   
2) Use the valueList() function to convert the query results to a
comma-delimited list of numbers
3) Use the listFind() function while outputing the select list items to
determine which "plantID's" should be preselected

<!--- convert "rsRepPlant" query results to list ---->
<cfset repPlantList = valueList(rsRepPlant.plantID)>

<form ....>
        ......
    <select name="plantid" size="10" multiple tabindex="7">
    <cfoutput query="rsPlant">
     <option value="#plantID#" <cfif listFind(repPlantList, plantID) gt
0>selected</cfif>>#plantName#</option>
    </cfoutput>
    </select>
        ......
</form>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.