Forums

Hide container

benbeek 02 Feb, 2014
I have a paymentform with a few containers:
Parent container (type tabarea) with label 'payment'
In there a few containers (type tab), with labels
- debitcharge
- ideal
- invoice

If I want to hide say the container type tab, with the label 'ideal' (because in this transaction I do not want to offer that payment method), what code can I use to hide this specific tab?

Regards,
Ben.
GreyHead 03 Feb, 2014
Hi benbeek,

I'm not sure if this will work tidily with tabs but I have used PHP in a Custom Code action to set CSS that will hide or show containers.
<?php
$css = array;
if ( some condition ) {
  $css[] = '#tab_id_a { display: none; }';
} else {
  $css[] = '#tab_id_a { display: block; }';
}
. . .
$css = implode("\n", $css);
$doc =& JFactory::getDocument();
$doc->addStyleDeclaration($css);
?>


Bob
benbeek 03 Feb, 2014
I am afraid this does not work Bob. I suppose the code should be:
<?php
$css = array();
if ( some condition ) {
  $css[] = '#tab_id_a { display: none; }';
} else {
  $css[] = '#tab_id_a { display: block; }';
}
. . .
$css = implode("\n", $css);
$doc =& JFactory::getDocument();
$doc->addStyleDeclaration($css);
?>

But even then, a container of the type 'tab' has no id - field to set. So how can I address it in a css statement?

Regards,
Ben
GreyHead 08 Feb, 2014
Hi Ben,

Apologies for my typos :-(

You also need to replace 'some_condition' with some valid PHP condition.

Bob
benbeek 09 Feb, 2014
Of course I understand that I need a conditional statement.

But I do not understand the "#tab_id_a" part, because, as I stated, there is no id to set in your container field. So, to repeat my question: how can I address your container field it in a css statement?

Regards,
Ben.
This topic is locked and no more replies can be posted.