zoeriley Posted October 25, 2002 Posted October 25, 2002 I have coded checkboxes where the FMP-ValueListItem tag draws the values out of the database. However, this particular value list has about 200 items on it, and right now it's formatted with a break <br> after each value item--but the page is still really long. Is there any way to format the Value List so that possibly a table can be created of the Value List? Possibly with two or three columns? I'm not sure if this is possible. This is the code I currently have. It all takes place within a single table cell right now, so I'd like to add a table within this cell if this is possible. <TD colspan="3" height="33"> <p><font size="-3">[FMP-ValueList: Countries, List=Countries] <input type="checkbox" name="Countries" value="[FMP-ValueListItem]" [FMP-ValueListChecked]> [FMP-ValueListItem]<br> [/FMP-ValueList] </font></p> </TD>
Garry Claridge Posted October 25, 2002 Posted October 25, 2002 A couple of methods exist, one uses CDML/Calculation Fields and the other uses Javascript. Here is a link to one of them: http://www.fmforums.com/threads/showflat.php?Cat=&Board=UBB22&Number=39074&Forum=UBB22&Words=colums&Match=Entire%20Phrase&Searchpage=0&Limit=25&Old=allposts&Main=38987&Search=true#Post39074 A search of these forums may reveal some more information. Good Luck. Garry
zoeriley Posted October 28, 2002 Author Posted October 28, 2002 I've been searching the forum, and I've tried the various solutions at the link that Garry provided, but I cannot get any of them to work. None of the solutions seem adapatable to checkboxes and pulling value lists. Does anybody else know of a solution for this? Basically what I have is a list of 200 countries in a value list, and letting them run in a single column down the webpage makes the page very long to print out, which is what visitors will be doing. Does anybody have any other ideas?
Garry Claridge Posted October 28, 2002 Posted October 28, 2002 Try this: <table><tr> <script>i = 1 ; nCols = 3 ; [FMP-ValueList: Countries, List=Countries] if ((i % nCols) == 0) { document.write("<td><input type="checkbox" name="Countries" value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem]</td></tr><tr>") ; } else { document.write("<td><input type="checkbox" name="Countries" value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem]</td>") ; } ; i++ ;[/FMP-ValueList] </script></tr></table> Good Luck. Garry
zoeriley Posted October 28, 2002 Author Posted October 28, 2002 Hi Garry, I pasted your code right into my HTML file, replacing the code from above. Unfortunately, it didn't work. When I ran it through a browser, nothing showed up, just a blank area--where before it was drawing a the long column of value list items from the database. Any ideas?
Garry Claridge Posted October 28, 2002 Posted October 28, 2002 Check the "Page Source" of the page in the browser. Can you see the values in that listing? Also, just try it on a section of the page which does not have any other tables or formatting. This is to see if it is not conflicting, and hence not displaying. For example, the <TD height="33"> may cause a problem when the embedded table will be much larger than that. You may have to post most of your page so that we can see what is happening. Or, make another page, for testing, which is very simple and plain. All the best. Garry
Garry Claridge Posted October 28, 2002 Posted October 28, 2002 Whoops, I forgot about the quotes when I copied and pasted. It should be: <table><tr> <script>i = 1 ; nCols = 3 ; [FMP-ValueList: Countries, List=Countries] if ((i % nCols) == 0) { document.write("<td><input type="checkbox" name="Countries" value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem]</td></tr><tr>") ; } else { document.write("<td><input type="checkbox" name="Countries" value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem]</td>") ; } ; i++ ;[/FMP-ValueList] </script></tr></table> This should work (I have tested it). Garry
zoeriley Posted October 28, 2002 Author Posted October 28, 2002 Thanks, Garry!!! That worked perfectly. Thank you SO much, you have solved a major headache for me! :-)
Garry Claridge Posted October 28, 2002 Posted October 28, 2002 Well done I guess you realise that you can change the number of colums by amending the "nCols = 3" assignment. All the best. Garry
clevow Posted December 12, 2003 Posted December 12, 2003 Okay, a year later.... When I use this code it displays properly. However, it doesn't work because the html it ends up generating includes all of the scripting stuff. For example, the code (from "view source") is: <table><tr><script> i = 1 ; nCols = 3; if ((i % nCols) == 0) { document.write("<td><input type="checkbox" name="Genre" value="adventure">adventure</td></tr><tr>");} else { document.write("<td><input type="checkbox" name="Genre" value="adventure">adventure</td>");}; i++; if ((i % nCols) == 0) { document.write("<td><input type="checkbox" name="Genre" value="animals">animals</td></tr><tr>");} else { document.write("<td><input type="checkbox" name="Genre" value="animals">animals</td>");}; i++; etc. the code in the unprocessed HTML is: <script> i = 1 ; nCols = 3; [FMP-ValueList: Genre, List=Genre List] if ((i % nCols) == 0) { document.write("<td><input type="checkbox" name="Genre" value="[FMP-ValueListItem]">[FMP-ValueListItem]</td></tr><tr>");} else { document.write("<td><input type="checkbox" name="Genre" value="[FMP-ValueListItem]">[FMP-ValueListItem]</td>");}; i++;[/FMP-ValueList] </script> Help? Thanks, Carrie
clevow Posted December 12, 2003 Posted December 12, 2003 nevermind. i'm not sure if i was hallucinating or what, but it does work.
Recommended Posts
This topic is 7722 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now