Hi Mark, Sorry for replying late. I just got a chance to go over the CF-Talk posts. I don't know whether I understand your problem right or not. But probably using Arrays (or Structs) might solve your problem? I would do something like this when calling CFC:
<cfset userValue = ArrayNew(2)> <cfset count = 0> <cfloop query="qUsers"> <cfset userValue[count][1] = "A#moduleID#"> <!--- I don't know you still want to pad "A" in front ---> <cfset userValue[count][2] = FORM[moduleID]> <cfinvokeargument name="#userValue[count][1]#" value="#userValue[count][2]#"> </cfloop> It would look like A155 = 3 "(moduleID) = (permissionID)" <cfset count = count + 1 > --- I think you get my drift. And I would do the appropriate in CFC as well. Please let me know if that helps at all. Thanks & Regards, Pine -----Original Message----- From: Mark Leder [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 15, 2006 2:24 PM To: CF-Talk Subject: Dynamic Form Selects and Posting Troubles Hi all, I've been pulling out my hair on this one over the last two days and I'm stumped. On a form page I have a series of drop down select boxes, dynamically produced and named. The "name" of each select (moduleID) is a three-digit number. So I could have FORM.133, FORM.147, FORM.155 and so on. The permission ID value is numeric 1 thru 5. I pull the recordset from a db and create the fieldnames and drop downs, like so (which works): <cfloop query="qUsers"> <cfset FORM[moduleID] = qUsers.permissionID> </cfloop> It would look like FORM.155 = 3 "(moduleID) = (permissionID)" <table border="0" cellspacing="0" cellpadding="3"> <cfloop query="qUsers"> <tr> <td><strong>#moduleName#</strong></td> <td> <select name="#moduleID#"> <option value="1" <cfif FORM[moduleID] EQ 1>selected</cfif> >(1) No Access</option> <cfif qUsers.moduleID NEQ 133> <option value="2" <cfif FORM[moduleID] EQ 2>selected</cfif> >(2) View Only</option> <option value="3" <cfif FORM[moduleID] EQ 3>selected</cfif> >(3) View-Edit</option> <option value="4" <cfif FORM[moduleID] EQ 4>selected</cfif> >(4) View-Add-Edit</option> </cfif> <option value="5" <cfif FORM[moduleID] EQ 5>selected</cfif> >(5) Complete Access</option> </select> </td> </tr> </cfloop> </table> Next I want to send the form fields to a cfc for db posting. So in my <cfinvoke> I loop through the FORM vars, like so: (Notice that I'm forced to prepend an "A" in front of the cfinvokeargument name - the cfc throws an error if arguments have names beginning with numbers) <cfloop query="qUsers"> <cfinvokeargument name="A#moduleID#" value="#FORM[moduleID]#"> </cfloop> It would look like A155 = 3 "(moduleID) = (permissionID)" Here's the real problem, trying to update an existing table with this data. In the CFC, the qPermissionCount gives me a count of how many rows have unique module numbers (in this case 3). <cfquery name="qPermissionCount" datasource="#REQUEST.dsnSQL#" username="#REQUEST.dsnUID#" password="#REQUEST.dsnPWD#"> SELECT U.userID, P.* FROM #SESSION.companyInfo.companyTablePrefix#_Users_List U, #SESSION.companyInfo.companyTablePrefix#_Users_List_UserModulesPermissio ns P WHERE U.userID = <cfqueryparam cfsqltype="cf_sql_char" value="#ARGUMENTS.userID#"> AND U.userID = P.userID </cfquery> Now, I can't seem to figure out how to loop for 3 records, and match up the FORM.A155 with the db record of 155 in order to update the permission level (1 thru 5). It's the SET that's the problem. Notice that the ARGUMENTS.a101 could be any number from A101 to A160. I can find which three numbers are being updated from the qPermissionCount recordset. <cfquery name="updOBJ2" datasource="#REQUEST.dsnSQL#" username="#REQUEST.dsnUID#" password="#REQUEST.dsnPWD#"> UPDATE #SESSION.companyInfo.companyTablePrefix#_Users_List_UserModulesPermissio ns SET permissionID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.A101#"> WHERE userID = <cfqueryparam cfsqltype="cf_sql_char" value="#ARGUMENTS.userID#"> AND moduleID = <cfqueryparam cfsqltype="cf_sql_integer" value="#qPermissionCount.moduleID#"> </cfif> </cfquery> Thanks, Mark ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235650 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

