Buy Now
Sign in

HTML List

kkurtz , December 01 2018, 19:02
K
kkurtz 123
December 01 2018, 19:02 #381936
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 8
December 01 2018, 21:24 #381939
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 DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
K
kkurtz 123
December 02 2018, 13:38 #381953
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 64
December 02 2018, 15:58 #381957
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 123
December 02 2018, 19:25 #381959
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)
318 Downloads/Views
healyhatman 8
December 02 2018, 20:33 #381960
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 DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
K
kkurtz 123
December 02 2018, 22:25 #381966
There will be some variability in the information presented on the form. Some of the form info will come out of a table.
healyhatman 8
December 02 2018, 22:42 #381969
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 DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
K
kkurtz 123
December 05 2018, 19:19 #382027
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 8
December 05 2018, 20:13 #382028
I don't see a button in that code
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
K
kkurtz 123
December 06 2018, 23:34 #382040
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 8
December 07 2018, 01:20 #382041
I doubt it. Clear Chrome's cache and hard reload.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
K
kkurtz 123
December 07 2018, 12:52 #382052
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 8
December 07 2018, 13:01 #382053
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 DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
K
kkurtz 123
December 08 2018, 00:18 #382063
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.