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

Query group in cfformgroup

New Here ,
Oct 31, 2008 Oct 31, 2008
Hi,

I can't figure out hvor to group output from a query like you can in the cfoutput tag with the group option.
<cfscript>
q1 = queryNew("id,firstname,lastname");
queryAddRow(q1);
querySetCell(q1, "id", "1");
querySetCell(q1, "firstname", "Rob");
querySetCell(q1, "lastname", "Smith");
queryAddRow(q1);
querySetCell(q1, "id", "2");
querySetCell(q1, "firstname", "John");
querySetCell(q1, "lastname", "Doe");
queryAddRow(q1);
querySetCell(q1, "id", "3");
querySetCell(q1, "firstname", "Jane");
querySetCell(q1, "lastname", "Doe");
queryAddRow(q1);
querySetCell(q1, "id", "4");
querySetCell(q1, "firstname", "Erik");
querySetCell(q1, "lastname", "Pramenter");
queryAddRow(q1);
querySetCell(q1, "id", "4");
querySetCell(q1, "firstname", "Jane");
querySetCell(q1, "lastname", "Jiggy");
queryAddRow(q1);
querySetCell(q1, "id", "4");
querySetCell(q1, "firstname", "Jane");
querySetCell(q1, "lastname", "Bush");
</cfscript>

From the above I would like to populate a tabnavigator using the id and each page populated with firstname and lastname inputfields.

Can anyone please help?
1.1K
Translate
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
Enthusiast ,
Nov 05, 2008 Nov 05, 2008
It's exactly the same

<cfform format="flash">
<cfformgroup type="tabnavigator">
<cfoutput query="q1" group="id">
<cfoutput>
<cfformgroup id="tab_#q1.currentrow#" type="page" label="Tab #q1.currentrow#">
<cfinput type="text" name="firstname_#q1.currentrow#" value="#q1.firstname#">
<cfinput type="text" name="lastname_#q1.currentrow#" value="#q1.lastname#">
</cfformgroup>
</cfoutput>
</cfoutput>
</cfformgroup>
</cfform>


Ken
Translate
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
New Here ,
Nov 07, 2008 Nov 07, 2008
LATEST
Hi ScareCrow,

I just made a slight modification to your code by moving the cfoutput inside the inner most cfformgroup like this;
<cfform format="flash">
<cfformgroup type="tabnavigator">
<cfoutput query="q1" group="id">
<cfformgroup id="tab_#q1.currentrow#" type="page" label="Tab #q1.currentrow#">
<cfoutput>
<cfinput type="text" name="firstname_#q1.currentrow#" value="#q1.firstname#">
<cfinput type="text" name="lastname_#q1.currentrow#" value="#q1.lastname#">
</cfoutput>
</cfformgroup>
</cfoutput>
</cfformgroup>
</cfform>

and it works like charm, thank you!

I did fiddle around with a cfoutput inside the form before I had to give up and post my question here. After your post I realized that the name of my query "q1" was probably the reason I couldn't get my output loop to work, as "q1" and "ql" looks very similar. Lesson learned, I have now changed my query name to "qq".

/Rune
Translate
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