Buy Now
Sign in

HTML List

kkurtz , December 01 at 19:02
K
kkurtz
I am trying to list table fields using HTML.
My index event is:
{fn:read_contacts_x_users}​
​{view:html7}
And the html7 view is:
<table>​
​<tr>​
​<th>Username</th>​
​<th>Name</th>​
​</tr>​
​<tr>​
​<td>{var:read_contacts_x_users.Contacts.username}</td>​
​<td>{var:read_contacts_x_users.Contacts.name}</td>​
​</tr>​
​</table>
Where read_contacts_x_users is the function and Contacts is the model name. I have tried various combinations here and nothing works. I get the header row but nothing else.
What am I doing wrong?
Karen
healyhatman
Well for a start you'd surely want a loop, to make a row for each entry, right?
And why not just use the TABLE view instead of making a manual one?
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
K
kkurtz
I'll see if I can figure out how to make a loop.
Why not use a TABLE view? - I am try to learn how to do a printer friendly page and I understand you have to format it with an HTML view.
What I really want to do is construct a form (which I know how to do) and then print the form. Can you point me in the right direction on the printing part?
Thanks,
Karen
GreyHead
Hi Karen,
Please see this FAQ
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
K
kkurtz
Bob,
I have constructed a very simple form in CF6. I should explain that this is not a fill-in form but is intended for the user to print and then mail in. Yes I know this is dark ages, but that is just how things work at the moment.
Right now the form has just has just a custom HTML section:
<div id="print_div">​
​<p>Preferred Course:_____________________________________</p>​
​<p>Alternate Choice: _____________________________________</p>​
​</div>
And a button
Then in the Setup in the Submit section I copied in the jQuery code in the FAQ:
<?php​
​$jdoc = \JFactory::getDocument();​
​$script = "​
​jQuery(document).ready(function(jQ){​
​ function printPage()​
​ {​
​ var html, css, csss_file, printWin;​
​ css = \"\";​
​ css = \"<style type='text/css'>\"+css+\"</style>\";​
​ css_url = '';​
​ if ( css_url !== '' ) {​
​ css_url = \"<link rel='stylesheet' type='text/css' href='\"+css_url+\"' media='print' />\";​
​ }​
​ html = '<html><head>'+css+css_url+'</head>'+jQ(id).html()+'</html>';​
​​
​ printWin = window.open('', '', 'left=100, top=100, width=600, height=400, toolbar=0, scrollbars=0, status=0' );​
​ printWin.document.write(html);​
​ printWin.document.close();​
​ printWin.focus();​
​ printWin.print();​
​ printWin.close();​
​ }​
​ var id;​
​ id = '#print_div';​
​ jQ('#print_button').css('visibility', 'visible');​
​ jQ('#print_button').click(printPage);​
​});​
​";​
​$jdoc->addScriptDeclaration($script);​
​?>
On Submit I am getting an error message:
errormessage.JPG
Any suggestions?
Karen
Attachments
errormessage.JPG
errormessage.JPG
(15.27 KiB)
86 Downloads/Views
healyhatman
If you don't need them to fill anything in why bother with a form at all? Make a pdf and just have them download it
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
K
kkurtz
There will be some variability in the information presented on the form. Some of the form info will come out of a table.
healyhatman
OK that makes more sense then.
The code you used doesn't go in the "Submit" section. It should go in a Custom HTML block in the Design tab.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
K
kkurtz
I did what you suggested and it was working until it wasn't. The print button doesn't appear now. Here is what I have in the Custom HTML Design block:
<div id="print_div">​
​<p>Preferred Course:_____________________________________</p>​
​<p>Alternate Choice: _____________________________________</p>​
​</div>​
​​
​<?php​
​$jdoc = \JFactory::getDocument();​
​$script = "​
​jQuery(document).ready(function(jQ){​
​ function printPage()​
​ {​
​ var html, css, csss_file, printWin;​
​ css = \"\";​
​ css = \"<style type='text/css'>\"+css+\"</style>\";​
​ css_url = '';​
​ if ( css_url !== '' ) {​
​ css_url = \"<link rel='stylesheet' type='text/css' href='\"+css_url+\"' media='print' />\";​
​ }​
​ html = '<html><head>'+css+css_url+'</head>'+jQ(id).html()+'</html>';​
​​
​ printWin = window.open('', '', 'left=100, top=100, width=600, height=400, toolbar=0, scrollbars=0, status=0' );​
​ printWin.document.write(html);​
​ printWin.document.close();​
​ printWin.focus();​
​ printWin.print();​
​ printWin.close();​
​ }​
​ var id;​
​ id = '#print_div';​
​ jQ('#print_button').css('visibility', 'visible');​
​ jQ('#print_button').click(printPage);​
​});​
​";​
​$jdoc->addScriptDeclaration($script);​
​?>
What now?
healyhatman
I don't see a button in that code
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
K
kkurtz
OK. My bad. I forgot to copy the button code.
Now that the button is back I have another issue. In Firefox I can enhance the button (change the color, placement, etc.). But Chrome ignores my CSS. Is the Semantic UI overriding the CSS?
healyhatman
I doubt it. Clear Chrome's cache and hard reload.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
K
kkurtz
That worked. thanks.
In a table list how can I get the contents of a cell to wrap? Or alternatively how can I put a horizontal scroll bar at the bottom of the list?
Thanks again,
Karen
healyhatman
have a look at the semantic ui documentation it's in there somewhere in layout I think. Midnight here
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
K
kkurtz
As far as I can tell you just have to specify the column width. Text will wrap if it needs to. Seems to work anyway.