Solved

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

Posted on 2012-03-13
2
177 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
cfchart issue with html 6 143
expandPath erroring 15 68
Coldfusion remove square brackets from string 4 128
popup load of page and setting up of session 8 44
This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

821 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