Hide empty fields

Bober

New Member
Hi,

I tried to hide empty fields following this thread.

My template.css.php in /var/www/joomla/components/com_fabrik/views/form/tmpl/bootstrap_tabs folder looks like:

PHP:
<?php
/**
* Fabrik Form View Template: Bootstrap Tab CSS
*
* @package    Joomla
* @subpackage  Fabrik
* @copyright  Copyright (C) 2005-2013 fabrikar.com - All rights reserved.
* @license    GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/
 
header('Content-type: text/css');
$c = (int) $_REQUEST['c'];
$view = isset($_REQUEST['view']) ? $_REQUEST['view'] : 'form';
echo "
 
.fabrikGroup {
clear: left;
}
 
#details_$c .fabrikDataEmpty{ display:none; }
 
";
 
 
 
?>

Still all the empty fields and their labels are visible.

What am I doing wrong?


Regards,

Bober
 
1. in general you shouldn't use template_css.php, it will be overridden with the next update (although it seems it's not used in details/bootstrap at the moment), use a file custom_css.php
2. the syntax has changed (and custom_css_example.php needs to be updated), use
Code:
<?php
header('Content-type: text/css');
$c = (int) $_REQUEST['c'];
$view = isset($_REQUEST['view']) ? $_REQUEST['view'] : 'form';
$rowid = isset($_REQUEST['rowid']) ? $_REQUEST['rowid'] : '';
$form = $view . '_' . $c;
if ($rowid !== '')
{
    $form .= '_' . $rowid;
}
echo "
 
/* BEGIN - Your CSS styling starts here */
 
#{$form}  .fabrikDataEmpty {
    display:none;
}
/* END - Your CSS styling ends here */
 
";
?>
 
Ok, Thanks for the answer. I have created a custom_css.php using the example file:

PHP:
<?php
/**
* Default Form Template: Custom CSS
*
* @package    Joomla
* @subpackage  Fabrik
* @copyright  Copyright (C) 2005-2013 fabrikar.com - All rights reserved.
* @license    GNU/GPL http://www.gnu.org/copyleft/gpl.html
* @since      3.0
*/
 
/**
* If you need to make small adjustments or additions to the CSS for a Fabrik
* template, you can create a custom_css.php file, which will be loaded after
* the main template_css.php for the template.
*
* This file will be invoked as a PHP file, so the view type and form ID
* can be used in order to narrow the scope of any style changes.  You do
* this by prepending #{$view}_$c to any selectors you use.  This will become
* (say) #form_12, or #details_11, which will be the HTML ID of your form
* on the page.
*
* See examples below, which you should remove if you copy this file.
*
* Don't edit anything outside of the BEGIN and END comments.
*
* For more on custom CSS, see the Wiki at:
*
* http://www.fabrikar.com/forums/index.php?wiki/form-and-details-templates/#the-custom-css-file
*
* NOTE - for backward compatibility with Fabrik 2.1, and in case you
* just prefer a simpler CSS file, without the added PHP parsing that
* allows you to be be more specific in your selectors, we will also include
* a custom.css we find in the same location as this file.
*
*/
 
header('Content-type: text/css');
$c = (int) $_REQUEST['c'];
$view = isset($_REQUEST['view']) ? $_REQUEST['view'] : 'form';
echo "
 
/* BEGIN - Your CSS styling starts here */
 
#{$view}_$c .foobar {
    display: none;
}
 
#{$form}.fabrikDataEmpty {
    display:none;
}
 
/* END - Your CSS styling ends here */
 
";
?>

Unfortunately its still not working...
 
I've fixed the custom CSS example in the tabs template locally, I'll commit the change when I've finished a couple of other things I'm working on at the moment.

-- hugh
 
I have the same problem as bober.

I want to hide empty fields.

the empty fields should be hidden in detail view, not in form/editing view.

Has someone an solution?
 
Did you try the example (post #2)?

Hi troester.

Thanks for your example (post #2), which worked in our case right away. After placing your file custom_css.php in the folder

/components/com_fabrik/views/details/tmpl/bootstrap_tabs/

only fields with content are shown. Wonderful!

Do you have any idea or advice how to supress the empty lines of those fields without content which are marked yellow in the following screenshot:

DadA-L_custom.php_empty_fields.png


In the yellow marked area are 6 fields without content. How can I get rid off with the formating of the empty line which is done by the class: "<div class="row-fluid"></div>"?

Would be nice and helpful if you or somebody else has an idea how to do this. Thanks.

Hajosch
 
When posting specific questions about CSS, it always helps to post a link to the page itself, rather than images. That way, it's much easier for people to actually inspect and test CSS solutions on the fly, rather than having to go and set up / recreate your scenario on their local servers.

If you can't point to your actual page (it's a local server, requires logon, whatever), setting up a test case on a server which people can see is useful. Basically, anything you can do to make it easier for people to respond in Community support will help you get answers. Personally, I simply don't have the time to very much Community support at all, and if it requires any kind of time setting up / recreating setups locally, I'll just move on. But for things like CSS issues, if there's a link I can click on and a page I can examine in Firebug, it's more likely I'll at least have a look and see if there's a quick fix.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top