conditionally hide a button in listview

jorgeiba

New Member
Hi, i have a problem in the listview. I need add a condition to show/hide a button of plugin email. The value is the 'Sum' of the element.

Can you help me?

Thanks for all.
 
Hi,

Here is one way to do it. You could create a calc element to calculate your sum and if your condition is met, then return a string.

Set this element to not show in the list and hidden, and set "Use as row class" to yes.

Example of such a calc element:
Code:
$bs = "{mc_contract_products___billing_start}";
if (date("Y",strtotime($bs)) != "-0001") {
  if (strtotime($bs) > time()) {
    return "my-info";
  } else {
    return "my-success";
  }
}
return "my-warning";


Then add some CSS to hide your button, this example sets colors. The trick here is that you want to set the display:none based on your row class followed by the email button class "email-0".
Code:
.my-info .mc_contract_products___billing_start  {
    .alert-info;
}
.my-warning .mc_contract_products___billing_start  {
    .alert;
}
.my-success .mc_contract_products___billing_start  {
    .alert-success;
}

Paul
 
Do you know how hide the button in the header of list? The buttons email in the column has been hidden correctly. The one top button isn?t.
 

Attachments

  • button.jpg
    button.jpg
    21.2 KB · Views: 132
I just saw that the list email plugin has a conditional field as well. I am not sure if it actually would hide the button, but it should do the trick.

http://fabrikar.com/forums/index.php?threads/send-email-when-checked.44429/
http://fabrikar.com/forums/index.php?wiki/email-list-plugin/

The condition in the list plugin doesn't affect whether an icon is shown. It's an SQL "where" clause we append when weeding out the selected rows. So if had "mail_sent = 0" as the condition (where mail_sent is a field on your form), and you selected 3 rows to send to, but one of them already had mail_sent = 1, that one wouldn't send. But it could still be selected.

-- hugh
 
That would be very challenging to make that conditional.
If you always want to hide it you can do that easily with some CSS

Code:
#list_108_checkAll { // Your checkAll checkbox ID
    display: none;
}

th div .email-0 {
    display: none;
}
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top