Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with lists and checkboxes

Status
Not open for further replies.

calista

Programmer
Jan 24, 2001
545
US
I think I posted this question before, but I still don't have it resolved and it's driving me crazy! X-)

I have two lists stored in my database, an employee list, and a list of roles(job descriptions). These lists contain information submited through a form in which the user is presented with a list of all employees, you check off the people you want to include, and there is a text box to enter a description. I can get the data into the database just fine. The employee list contains only the selected employees (I am actually storing their ID#), and the list of roles contains that information.

Now, I am writing an edit function. I want to present the list of all employees, with the ones in the list already checked off and show their respective roles. Because is am storing their ID#s, I have to query my employee table to get the names. The lists are in a project table. I want to present this is a table, so it is nice and neat. I can get one list or the other to display correctly, but not both at the same time. Any suggestions? Iza? Simmerdown? Seems like you've been dealing with similar things. GunJack, you've been a tremendous help! I'm just a struggling newbie. I'll take any help I can get. Thanks a lot! :)
 
you've got a list of employees and a list of roles; they should match (in the way : employee #3 in the list of employees has role #3 in the list of roles); and you want to display both lists at the same time and you can't ??????? it's weird !
----
if your lists match, then they have the same lenght, so looping over one or the other should be the same
loop over any of the two lists, and display their value in a table this way :
<table>
<cfloop ....>
<tr><td>#list_of_employee[an_index]#</td><td>#list_of_roles[an_index]#</td></tr>
</cfloop>
</table>
--> i'm not sure wheter list[index] is good, i supposed it was an array, but if it's a list maybe it's list.get_value(index) or something, anyway you still can ListToArray(yourlist)
-----
you can also (instead of building 2 lists) build a 2dimensional array, and use it this way :
<tr><td>#your2darray[an_index][0]#</td><td>#your2darray[an_index][1]#</td></tr>
-----
maybe i didn't get the question correctly ?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top