Solved

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

Posted on 2012-03-13
2
169 Views
Last Modified: 2012-04-14
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
0
Comment
Question by:brihol44
2 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 37720115
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>
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 350 total points
ID: 37722587
Wouldn't placing it before the inner cfoutput do the same thing?

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now