Link to home
Start Free TrialLog in
Avatar of brihol44
brihol44

asked on

I would like to add a field for adding adding sub-categories within my coldfusion query output

I have my cfoutput working just fine like so....

<cfoutput query="test" group="record_ID">
Main Category  
   <cfoutput>
   Sub Category
   <cfoutput>
</cfoutput>

I would like to add a field though for adding sub-categories like so....


<cfoutput query="test" group="record_ID">
Main Category  1
   <cfoutput>
  1 input field and submit button to add more sub-categories then list all sub-categories
   Sub Category 1
   Sub Category 2
   Sub Category 3
   <cfoutput>
</cfoutput>

I'm wondering if using a cfloop is the way to go but I'm hoping to have the 1 field be at the top or above all sub-categories and below the main categories so the user can enter in more sub-categories.

Thanks,

Brian
Avatar of gdemaria
gdemaria
Flag of United States of America image

Sure, you can add a CFIF statement with a flag each time the category changes like this..

This will show only one field for every category..

<cfoutput query="test" group="record_ID">
  Main Category  1
   <cfset newCategory = true>
   <cfoutput>
    <cfif newCategory>
       1 input field and submit button to add more sub-categories then list all sub-categories
       <cfset newCategory = false>
    </cfif>
   Sub Category 1
   Sub Category 2
   Sub Category 3
   <cfoutput>
</cfoutput>
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial