CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   ColdFusion (http://www.codingforums.com/forumdisplay.php?f=45)
-   -   CurrentRow MOD And Br (http://www.codingforums.com/showthread.php?t=263220)

theborg72 06-01-2012 11:20 AM

CurrentRow MOD And Br
 
hello I'm trying to get a loop. The idea is to just
create a table that shows 2 row and 5 column.


Instead of
1
2
3
4
a.s.o


I want
12345
space writable
678910


I've made a CurrentRow MOD and it working right to left, but
not the space

even if it is possible to loop the table instead of the columns


Code:

<table width="500" border="1">
<tr><cfoutput query="testrec" startRow="#StartRow_testrec#" maxRows="#MaxRows_testrec#">
<td>#testrec.tblOnskelista# </td>
<CFIF testrec.CurrentRow MOD 5 IS 0>
 
</TR>
<TR></TR>
</CFIF>
</cfoutput>
</table>


WolfShade 06-01-2012 01:36 PM

Code:

<table width="500" border="1">
<tr>
<cfoutput query="testrec" startRow="#StartRow_testrec#" maxRows="#MaxRows_testrec#">
<td>#testrec.tblOnskelista# </td>
<CFIF testrec.CurrentRow MOD 5 IS 0>
</tr>
<tr><td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
<tr>
</CFIF>
</cfoutput>
</table>

This _should_ give you the blank space in between. If you want to output data from another cfoutput, the outer cfoutput should use the group attribute and the inner cfoutput should surround only ONE td with the data inside the td.

theborg72 06-01-2012 01:46 PM

allmost :)
 
it gives me the space between entries. I was looking for was more like this

table 1
[1][2][3][4][5]

space to write in

table 2
[6][7][8][9][10]

WolfShade 06-01-2012 05:12 PM

Is "space to write in" a textarea? What are you thinking of?

theborg72 06-01-2012 05:48 PM

yes.. like a text area

This is an example of how I want it to look like

the gallery.

WolfShade 06-01-2012 05:52 PM

Code:

<table width="500" border="1">
<tr>
<cfoutput query="testrec" startRow="#StartRow_testrec#" maxRows="#MaxRows_testrec#">
  <td>#testrec.tblOnskelista# </td>
  <CFIF testrec.CurrentRow MOD 5 IS 0>
  </tr>
  <tr>
    <td colspan="5"><textarea id="thisTextarea#
testrec.CurrentRow#" name="thisTextarea#testrec.CurrentRow#"></textarea></td>
  </tr>
  <tr>
  </CFIF>
</cfoutput>
</table>


theborg72 06-01-2012 06:14 PM

But now it's the same on both fields. The clone what you write and it becomes equal on the bottom. it'll just be text between these two lines. not under

WolfShade 06-01-2012 06:35 PM

The code will place a textarea after every 5 records (per your modulus equation). If you are returning 10 records, there will be 5 records, then a textarea, then five records, then a textarea. If you are returning only 9 records, only one textarea will be placed. If you do not want more than one textarea, then you can modify the conditional to include "AND testrec.Currentrow eq 5" so that a textarea will ONLY be placed after the fifth record, and no more.

theborg72 06-01-2012 07:23 PM

Quote:

Originally Posted by WolfShade (Post 1235744)
The code will place a textarea after every 5 records (per your modulus equation). If you are returning 10 records, there will be 5 records, then a textarea, then five records, then a textarea. If you are returning only 9 records, only one textarea will be placed. If you do not want more than one textarea, then you can modify the conditional to include "AND testrec.Currentrow eq 5" so that a textarea will ONLY be placed after the fifth record, and no more.

it works perfectly on the 10 first. but then when you take the next 10 the script dont work.

WolfShade 06-01-2012 07:26 PM

<CFIF testrec.CurrentRow MOD 5 EQ 0 AND testrec.CurrentRow MOD 10 NEQ 0>

theborg72 06-01-2012 07:38 PM

Quote:

Originally Posted by WolfShade (Post 1235755)
<CFIF testrec.CurrentRow MOD 5 EQ 0 AND testrec.CurrentRow MOD 10 NEQ 0>

YES thats it..

I do not know how I can thank you. that's exactly what I was looking for. Thank you very much.:thumbsup:

theborg72 06-01-2012 08:01 PM

Just a quick question how do I do if there are not 10 then disappears text field tried me on a <cfelse> and add the field. but it does not work :confused:


All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.