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!

More Editing questions

Status
Not open for further replies.

calista

Programmer
Jan 24, 2001
545
US
Just when I think I've covered all the bases, something else comes up! X-)

I am trying to retreive two list from my database and populate a form with them. List1 is a list of peoples' names, and the user may select any number of them. List2 is a brief job title that is input in a textarea, and co-responds to a selected name. When I load the data to edit, I can get the names and prefill the appropriate checkboxes, but I cannot seem to get the job title to load alongside of it. I want to present this in a table to make it neat and tidy.

I should point out that List1 is actually a list of ID numbers, and I query another table to get the name. To clarify, List1 and List2 are in the same table.

Here is the code I have:

Code:
<table width=&quot;80%&quot; align=&quot;center&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot;>
<tr>
	<td width=&quot;20%&quot; align=&quot;center&quot;>Name</td>
	<td width=&quot;80%&quot; align=&quot;center&quot;>Role</td>
</tr>
<cfoutput query=&quot;GetPeople&quot;>
<tr>
    <td align=&quot;left&quot; width=&quot;20%&quot;>
	<input type=&quot;Checkbox&quot; name=&quot;ProjTeamMembers&quot; value=&quot;#PersonID#&quot;
	<cfif listfind(GetProjectInfo.ProjTeamList,PersonID) gt 0> checked</cfif>>
		#PersonFirstName# #PersonLastName#</td>
    <td align=&quot;left&quot;><TEXTAREA NAME=&quot;ProjTeamRoles&quot;, ROWS=1, COLS=75>
		<CFLOOP INDEX=&quot;Counter&quot; LIST=&quot;#GetProjectInfo.ProjTeamRoles#&quot;>#Counter#</CFLOOP>
	</TEXTAREA></td>
</tr>
</cfoutput>
</table>

Thanks for everyone's help! I've been working at teaching myself CF for several weeks, now, so I'm pretty new at it.(I did actually manage to answer one question posted on this forum!) I'll certainly contribute whenever I can. Thanks again! :)
 
Hey Calista,

I don't see anything obviously wrong so I would ask what is the exact problem? Is it that the textarea is blank or does the textarea contain the wrong role, or does it contain more roles than it should?

Also, if you do this statement, what does the output look like?
<cfoutput>#GetProjectInfo.ProjTeamRoles#</cfoutput>

GJ
 
Sorry about that. I must have lost part of my message in the editing process. What happens is that all of List2 appears in each textarea.
 
To answer your question about the output, I get the entire list.
 
Hey Calista,

That's what I would expect as your <cfloop> in the textarea is simply looping through the entire list and outputting each one. You'll need to put a <cfif> statement in the loop to determine if you should output each item.

The real question is how do you tie each item in the list back to a person in the getPeople query?

GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top