I the form i have 2 drop down . from first when i select the item it
automatically populate the second drop down. Then if I pick something from the
second drop down I want to remove that Item from tHe db. tH EPROBLEM IS IT
SHOULD GET REMOVED from the column called foundOn which is the list.
<fieldset>
<h2><b>Add/Remove Items from the list</b></h2>
<label for="selTopLevel2" style="font-size:12px"><b>List available
Items</b></label>
<select name="selTopLevel2" id="selTopLevel2" >
<option value="">Please select one</option>
<cfoutput query="topMenu">
<option value="#menuId#">#label#</option>
</cfoutput>
</select>
<input type="submit" name="showSeleted" id="showSelected" value="Pick Selected"
/><br />
<!---Populate items based on seletion--->
<cfif structKeyExists(form,"selTopLevel2")>
<table width="700" align="center">
<tr>
<th width="275" scope="col">Items that has been
assigned </th>
<th scope="col"> </th>
<th width="275" scope="col">All Items</th>
</tr>
<tr>
<td width="275" align="center" valign="top">
<select name="assignedTo" id="assignedTo" multiple="multiple">
<cfoutput>
<cfloop query="topMenuAssigned">
<option value="#menuId#">#label#</option>
</cfloop>
</cfoutput>
</select>
</td>
<td align="center" valign="top">
<br/>
<input type="submit"
name="btnRemoveItem" id="btnRemoveItem" value="-" alt="Remove Item"/>
<input type="submit" name="btnAddItem"
id="btnAddItem" value="+" alt="Add Item"/>
</td>
<td width="275" align="center" valign="top">
<select name="showAllItems" id="showAllItems" multiple="multiple">
<cfoutput query="topMenu">
<option value="#menuId#">#label#</option>
</cfoutput>
</select>
</td>
</tr>
</table>
<br />
<cfelse>
<cfabort>
<p style="color:red">Nothing was selected</p>
</cfif>
<!---End of Populate items based on seletion--->
</fieldset>
<cfif isDefined("form.btnRemoveItem")>
<cfquery name="remFromList" datasource="cfelsunrise" dbtype="ODBC">
select foundOn from menu where menuId=#form.selTopLevel2#
</cfquery>
<cfset myLsit=ValueList(remFromList.foundOn)>
<cfset newList=ListFind(myLsit,form.assignedTo)>
<cfif newList is 1>
<cfloop From = "1" To = "#ListLen(newList)#" index = "Counter">
<cfset newList2=ListDeleteAt(newLIst,ListGetAt(newList, Counter))>
</cfloop>
</cfif>
<cfquery name="removeFromList" datasource="cfelsunrise" dbtype="ODBC">
update dbo.Menu
set foundOn=#newList2#
where menuId=#form.selTopLevel2#
</cfquery>
</cfif>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299558
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4