Just for fun, try:
<snip>
<CFQUERY DATASOURCE="perm" NAME="getgroups">
SELECT groupid, groupname, permname, permid
FROM groups, permissions
</CFQUERY>
<cfset ListGroupID = ValueList(getgroups.GroupID)>
<snip>
<cfscript>
tChecked = '';
if (ListFind(ListGroupID,qryGetUserGroupsPerms.GroupID))
tChecked = ' checked';
</cfscript>
<input type="checkbox" name="groupid" value="#getgroups.groupid#"#tChecked#>
<snip>
I find that the seperation of the logic and the display of the tag makes it
easier for me to trouble-shoot. The real problem appeared to be that you
were referencing the same query on both sides of the if statement for the
checkbox, which to me was harder to spot having it all strung in the html
like that.
Hope this helps,
Calvin
----- Original Message -----
From: "Ian Vaughan" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, June 19, 2003 4:50 AM
Subject: Why is this not working the way it should ???
> Any idea why the code below is not working the way it should, as you can
see
> from my cfif statements the checkbox fields should only be checked if
there
> is a value in the database for that entry and the same for the permissions
> select.
>
> But at present every checkbox is checked and every select box is populated
> with a value when it should'nt be ?
>
> Can anybody see why this is occuring is it my queries, the placing of my
> cfoutputs? or the actual cfif statements ??
>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
> <title>Untitled</title>
> </head>
>
> <body>
> <CFQUERY DATASOURCE="perm" NAME="updateusers">
> SELECT *
> FROM users
> WHERE id = #session.id#
> </CFQUERY>
>
>
> <CFQUERY DATASOURCE="perm" NAME="getgroups">
> SELECT groupid, groupname, permname, permid
> FROM groups, permissions
> </CFQUERY>
>
> <cfquery datasource="perm" name="qryGetUserGroupsPerms">
>
> SELECT users.id AS "userid",
>
> users.fname,
> users.lname,
> users.username,
> users.password,
> users.email,
> users.position,
> users.division,
> groups.groupname,
> permissions.permname,
> userpermissions.groupid,
> userpermissions.permid
>
> FROM ((
> users INNER JOIN usergrouppermissions AS userpermissions ON users.id =
> userpermissions.userid)
>
> INNER JOIN permissions AS permissions ON userpermissions.permid =
> permissions.permid)
>
> INNER JOIN groups AS Groups ON userpermissions.groupid = groups.groupid
>
> WHERE (((users.id)=#session.id#));
>
> </cfquery>
>
> <table>
> <cfoutput query="getgroups" group="groupID">
> <tr>
> <td width="39%" height="20">#getgroups.groupname#</td>
>
> <td width="3%" align="center" height="20">
> <input type="checkbox" name="groupid" value="#getgroups.groupid#"
<cfif
> getgroups.GroupID IS getgroups.groupid> checked</cfif>>
> </td>
>
> <td width="45%" height="21">
> <select size="1" name="perm#qryGetUserGroupsPerms.groupid#">
> <cfoutput>
>
>
> <option value="#getgroups.PermID#" <cfif
qryGetUserGroupsPerms.PermID
> IS getgroups.PermID>selected</cfif> >#getgroups.PermName#</option>
> </cfoutput>
> </select>
> </td>
>
> </tr> </cfoutput>
> </table>
>
> </body>
> </html>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
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
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4