You never start a new row in your loop. You only end rows.

Try changing this...
<CFIF i MOD 2 EQ 0></TR></CFIF>

To this...
<CFIF i MOD 2 EQ 0 or i is ArrayLen(imgArray)></TR><cfif i neq 
ArrayLen(imgArray)><tr><cfif></CFIF>


Basically it says... if this elements position is evenly divisible by 2 -OR- it 
is the last element, then end the current row. If ending the row, check to see 
if the element is the last one in the array. If it is NOT, then start a new row.

..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com

-----Original Message-----
From: Bruce Sorge [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 22, 2007 12:53 PM
To: CF-Talk
Subject: Tables Not Working Right

I am working on an app I did a LONG time ago. When I go to the form using the 
code below, the tables do not stack, they are all side by side. The code is as 
follows:

 

<cfdirectory action="list" 

                         directory="#application.liveDir#"

                                                 name="ImageDirectory"

            />

 

                        <form method="post" action="addClass.cfm">

                        <table width="50%" align="left" border="0">

                                    <tr>

                                                <th width="10%"
align="left">

                                                            Class Title:

                                                </th>

                                                <td align="left"
width="90%">

                                                            <input type="text" 
name="classTitle" size="30" />

                                                </td>

                                    </tr>

                                    <tr>

                                                <th width="10%"
align="left">

                                                            Class
Description:

                                                </th>

                                                <td width="90%"
align="left">

                                                            <textarea 
name="classDescription" rows="5" cols="50"></textarea>

                                                </td>

                                    </tr>

                        </table>

 

                        <!--- Take the contents and turn them into an array
--->

                        <cf_QueryToArray Query = "ImageDirectory" Array = 
"imgArray" Transpose="Yes" AddColumnName = "Yes">

                        <table width="50%" align="LEFT" border="0">

                                    <tr>

                                                <CFLOOP FROM=1 
TO=#ArrayLen(imgArray)# INDEX=i>

                                                            <cfoutput>

                                                                        <td 
align="center">

                                                                        <img 
border="0" src="../../CourseImages/#URLEncodedFormat(imgArray[i][5])#"
height="150" width="150"></a>

                                                                        <BR />

 
<input type="checkbox" name="newImageName" value="#imgArray[i][5]#" />

 
</td>

                                                             </cfoutput>

                                                             <CFIF i MOD 2 EQ 0>

 
</TR>

                                                            </CFIF>

                                    </CFLOOP>

                        </table>

        

                        <table width="100%" border="0" align="left">

                                    <tr>

                <td colspan="3" align="left">

                                    <input type="submit" value="Add Class 
Class" /> | <input type="reset" />

               </td>

           </tr>

                </table>

            <input type="hidden" name="Action" value="addClass" />

</form>

 

I tried putting a break and paragraph tag between the tables as well as playing 
with the width to see if that does anything, but nothing works.. Any ideas? I 
do not remember the app behaving like this when I wrote it, but then again it 
was a long time ago. I am actually in the process of re-writing this, but this 
is bothering me.

 

Thanks,

Bruce

 

 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281922
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to