I'm creating an admin section where users can select from a series of
checkboxes (for example itemColor or itemSize).

When I examine the db I see there was no problem inserting the data via the
checkboxes. However I'm having problems in the "edit" screen when I want to
show the user the selected items.

Example: user selects white and black

[X]White
[X]Black
[ ]Red
[ ]Green
[ ]Blue

White and Black are inserted correctly. In the edit screen I would like the
user to see the itemColors selected. Everything works well EXCEPT when the
checked item is greater than 10.

For example: user select Polka Dots

1. [ ]White
2. [ ]Black
3. [ ]Red
4. [ ]Green
5. [ ]Blue
....
12.[X]Polka Dots

It's inserted correctly into the table

itemColors
itemID=123
itemColor=12

However it's displayed as Black, White and Polka Dots

1. [X]White
2. [X]Black
3. [ ]Red
4. [ ]Green
5. [ ]Blue
....
12.[X]Polka Dots

1,2, and 12 are shown as selected. If 13 Blue Stripes was selected then
1,3, and 13 would be displayed.

The relevant tables are

items (name,desc,etc...) and
itemColors(itemID, itemColorID)

When updates to the colors are made first all rows associated with the
itemID are deleted then new rows are inserted. This works as expected.

The relevant code is below. I just don't see what I'm missing.

<td>
<cfoutput query="getColors">
        <input type="checkbox" name="color" value="#colorID#"
        <cfif 
listContains(valueList(getItemColors.colorID),colorID)>CHECKED</cfif>
        >#colorName#
</cfoutput>
</td>

<cfif act EQ "edit">

        <cfquery name="getItem" datasource="storeRazor">

                SELECT items.*, itemType.*, categories.*,designers.*
                FROM items,itemType,categories,designers
                WHERE
                        items.itemID=#ID# AND
                        items.categoryID = categories.categoryID AND
                        items.itemTypeID = itemType.itemTypeID AND
                        items.designerID = designers.designerID

        </cfquery>

        <cfquery name="getItemColors" datasource="storeRazor">

                SELECT *
                FROM itemColors
                WHERE itemID = #ID#

        </cfquery>
        <cfquery name="getItemSizes" datasource="storeRazor">

                SELECT *
                FROM itemSizes
                WHERE itemID = #ID#

        </cfquery>

<cfelse> .... </cfif>


Gil




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199858
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to