• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfcs starter

New Here ,
Feb 01, 2009 Feb 01, 2009

Copy link to clipboard

Copied

Hi i have been playing around with cfc's

what i would like to do is this

i have created 2 functions the first gets a list of groups

then the second get a list of names passing in the groupid variable

groupname1
name1
name2
name3
groupname2
groupname3

what i need is to have the groupnames as links then onclick load the child names for that group

can smeone help me please

thank you in advance
TOPICS
Advanced techniques

Views

271

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 02, 2009 Feb 02, 2009

Copy link to clipboard

Copied

LATEST
I don't know if I properly understood your post but you don't really need a CFC to accomplish that. Second, this is the advanced forum, so this is not the right forum for an issue of this nature. Again, you didn't really explain why you need a CFC but I will try to reply to your post in the best of my abilities despite the lack of details in the information you provided.

First of all, let's talk about CFCs. CFC is a coldfusion component and in my daily tasks I use CFCs to put together all the functions I use in the system and to put together some special functionality that I repeatedly use in my system. There are other uses depending on your system. What's your scenario? You can call CFCs by including it in your cfm files through <cfinclude>, by using <cfinvoke>, or by invoking your CFC in your session scope (those are the scenarios where I call my CFCs on a daily basis, this doesn't mean they are the only tecniques allowed.)

But to accomplish what you want to accomplish you need two functions. Imagine that you created the function getGroups(), and get GroupMembers()

<html>
<head><title>Example</title></head>
<body>
<cfloop index="idx" from="1" to="#getGroups.recordcount#">
<cfquery name="getMembersofGroup" datasource="#application.dsn#" dbtype="query">
select * from groupmembers where group="#getGroups.groupId[idx]#"
</cfquery>

Group: #getGroups.GroupDesc[idx]#:
<div id="divId_#idx#" onClick="JSFunctionThatShowandHidesDiv();">
<table>
<cfloop index="ind" from="1" to="#getMembersofGroup.recordcount#">
<tr>
<td>#groupMembers[ind]#</td>
</tr>
<cfloop>
</table>
</div>


</cfloop>
</body>
</html>

The next step is to create a small javascript function that hide and show html divs. I don't have time to type it for you, please research it. Let me give you a hint:

document.getElementById('divId').style.visibility='hidden';
or
document.getElementById('divId').style.visibility='visible';

I hope this helps and like I said, you did not really explain what you were trying to accomplish with your CFCs.

Have a nice day!

Ysais.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation