Skip to main content
Inspiring
August 23, 2007
Question

Accordion

  • August 23, 2007
  • 1 reply
  • 282 views
Hi --

I am reposting this to another group as I got no response in the DB group.

Rich


"Rich Morey" <rwmorey71@hotmail.com> wrote in message
news:<fafbbf$gkp$1@forums.macromedia.com>...
> Hi --
>
> I would like to build an accordion by iterating through a record set and
> create the open and close tags for the accordion based on a value in my
> database. However, when I try using the <cfif>/<cfelse> tags with
> <cfformgroup> inside I get an error because I have my </cfformgroup>
> before
> the <cfformgroup>
>
> Below is my current code:
>
> <cfform name="frmMainMenu" format="flash">
> <cfformgroup type="accordion">
> <cfoutput query="qryMenu">
> <cfif #LINK# eq ''>
> <cfformgroup type="page" label="#DESCRIPTION#" name="page#ID#"/>
> <cfelse>
> <cfinput name="btn#ID#" type="button" value="#DESCRIPTION#">
> </cfif>
> </cfoutput>
> </cfformgroup>
> </cfform>
>
> As you can see I have the CFFORMGROUP self closing at the moment. What I
> want to do is this
>
> if (link = "")
> close the open CFFORMGROUP (if open)
> open the next CFFORMGROUP
> else
> display a button inside the CFFORMGROUP
>
>
> I would set a variable prior to the first record to not close the
> cfformgroup since none is open and then I would have a cfformgroup closed
> at
> the end of my loop.
>
> Can anyone help me out here?
>
> Thanks
>
> Rich
>
>

This topic has been closed for replies.

1 reply

Inspiring
August 24, 2007
I figured it out in case anyone else wanted to know..

<cfquery name="qryMenu" datasource="cfWebHotel">
SELECT *
FROM dbo.tableNewMenu
ORDER BY ID ASC
</cfquery>
<cfform format="flash" name="myForm" onload="onLoadForm();" width="210">
<cfformitem type="script">

import mx.core.View;
import mx.containers.*;
import mx.controls.Button;

function onLoadForm() {
var top = 1;
<cfoutput query="qryMenu">
<cfif #LINK# is ''>
var child_obj = my_acc.createChild(Canvas, "inst#ID#",
{label:"#DESCRIPTION#"});
top = 1;
<cfelse>
var menuButton:Object = child_obj.createChild(Button, "btn#ID#", {_x:1,
_y:top, width:180, label:"#DESCRIPTION#"});
top = top + 22;
</cfif>
</cfoutput>
}
</cfformitem>
<cfformgroup type="accordion" id="my_acc" width="184">
</cfformgroup>

</cfform>
"Rich Morey" <rwmorey71@hotmail.com> wrote in message
news:fak31u$2g3$1@forums.macromedia.com...
> Hi --
>
> I am reposting this to another group as I got no response in the DB group.
>
> Rich
>
>
> "Rich Morey" <rwmorey71@hotmail.com> wrote in message
> news:<fafbbf$gkp$1@forums.macromedia.com>...
>> Hi --
>>
>> I would like to build an accordion by iterating through a record set and
>> create the open and close tags for the accordion based on a value in my
>> database. However, when I try using the <cfif>/<cfelse> tags with
>> <cfformgroup> inside I get an error because I have my </cfformgroup>
>> before
>> the <cfformgroup>
>>
>> Below is my current code:
>>
>> <cfform name="frmMainMenu" format="flash">
>> <cfformgroup type="accordion">
>> <cfoutput query="qryMenu">
>> <cfif #LINK# eq ''>
>> <cfformgroup type="page" label="#DESCRIPTION#" name="page#ID#"/>
>> <cfelse>
>> <cfinput name="btn#ID#" type="button" value="#DESCRIPTION#">
>> </cfif>
>> </cfoutput>
>> </cfformgroup>
>> </cfform>
>>
>> As you can see I have the CFFORMGROUP self closing at the moment. What I
>> want to do is this
>>
>> if (link = "")
>> close the open CFFORMGROUP (if open)
>> open the next CFFORMGROUP
>> else
>> display a button inside the CFFORMGROUP
>>
>>
>> I would set a variable prior to the first record to not close the
>> cfformgroup since none is open and then I would have a cfformgroup closed
>> at
>> the end of my loop.
>>
>> Can anyone help me out here?
>>
>> Thanks
>>
>> Rich
>>
>>
>