Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display problem 1

Status
Not open for further replies.

calista

Programmer
Joined
Jan 24, 2001
Messages
545
Location
US
This is probably simple, but I'm drawing a blank. Here is my form element as it stands:

<FORM ACTION=&quot;#CGI.SCRIPT_NAME#&quot; METHOD=&quot;POST&quot; ENABLECAB=&quot;No&quot; ENCTYPE=&quot;multipart/form-data&quot;>
<CFOUTPUT QUERY=&quot;GetPeople&quot;>
<INPUT TYPE=&quot;checkbox&quot; NAME=&quot;Receipient&quot; VALUE=&quot;#PersonID#&quot;<CFIF LISTFIND(MailingList,PersonID) GT 0> checked</CFIF>>  #PersonFirstName# #PersonLastName#<BR>
</CFOUTPUT><BR>
<INPUT TYPE=&quot;submit&quot; NAME=&quot;Submit&quot; VALUE=&quot;Edit List&quot;>     
<INPUT TYPE=&quot;reset&quot; NAME=&quot;Reset&quot; VALUE=&quot;Clear Selections&quot;>
</FORM>

This displays a rather long list of checkboxes with a person's name beside each one. What I would like to do is display them table style, maybe 3 names across like this:

Name 1 Name 2 Name 3
Name 4 Name 5 Name 6
Name 7 Name 8 Name 9
|
|
V
etc.

Of course, I still want the checkbox for each one. I've considered loops, arrays and tables, but I just can't seem to figure out how to do this. As soon as someone tells me, I'm sure I'll say &quot;Doh![blush] Why didn't I think of that?&quot; Calista :-X
Jedi Knight,
Champion of the Force
 
Here's one way:

[COLOR=000080][COLOR=FA5000]<FORM ACTION=&quot;#CGI.SCRIPT_NAME#&quot; METHOD=&quot;POST&quot; ENABLECAB=&quot;No&quot; ENCTYPE=&quot;multipart/form-data&quot;>[/color][/color]

<CFSET vMaxCol = 3> [COLOR=666666]<!--- Max Number of Columns --->[/color]
<CFSET c = 0> [COLOR=666666]<!--- Column Cell Count --->[/color]
[COLOR=008080]<TABLE BORDER=0>[/color]
<CFOUTPUT>
<CFOUTPUT QUERY=&quot;GetPeople&quot;>
[COLOR=666666]<!--- Begging of Row --->[/color]
<CFIF NOT c Mod variables.vMaxCol>
[COLOR=008080]<TR>[/color]
</CFIF>
<CFSET c = c+1>

[COLOR=008080]<TD>[/color][COLOR=000080][COLOR=FA5000]<INPUT TYPE=&quot;checkbox&quot; NAME=&quot;Receipient&quot; VALUE=&quot;#PersonID#&quot;<CFIF LISTFIND(MailingList,PersonID) GT 0>[/color][/color] checked</CFIF>> #PersonFirstName# #PersonLastName#[COLOR=008080]</td>[/color]

[COLOR=666666]<!--- End the row and restart the count --->[/color]
<CFIF NOT c Mod variables.vMaxCol>
[COLOR=008080]</TR>[/color]
<CFSET c = 0>
</CFIF>

</CFOUTPUT>

[COLOR=666666]<!--- If we are short a few cell, then make a few more --->[/color]
<CFIF variables.vMaxCol - c>
<CFOUTPUT>#RepeatString(&quot;<TD> </TD>&quot;, variables.vMaxCol - c)#[COLOR=008080]</TR>[/color]</CFOUTPUT>
</CFIF>

[COLOR=008080]</TABLE>[/color]
[COLOR=000080]<BR>[/color]
[COLOR=000080][COLOR=FA5000]<INPUT TYPE=&quot;submit&quot; NAME=&quot;Submit&quot; VALUE=&quot;Edit List&quot;>[/color][/color]
[COLOR=000080][COLOR=FA5000]<INPUT TYPE=&quot;reset&quot; NAME=&quot;Reset&quot; VALUE=&quot;Clear Selections&quot;>[/color][/color]
[COLOR=000080][COLOR=FA5000]</FORM>[/color][/color] - tleish
 
Bless you, tleish! This is perfect! It took me a little while to try it because I was distracted by other priorities. (I'm sure that's never happend to you!)

[2thumbsup] Calista :-X
Jedi Knight,
Champion of the Force
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top