• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

hide update_col based on field value

jo-ka

Member
Hello.
Is there a way to hide the update_col button from a list, based on the value of on of the fields?

For example, a field with Inveted, Accept and Reject options. The user can select the buttons to Accept or Reject but, once one of the options is selected (updated by update_col), the user can't see the buttons anymore.

Thanks in advance.
 
Select the option "use as row class" for the status element. So when the status field value is for example "reject", you will have your row class something like "yourelementclass_reject" (inspect with browser inspect tool to find out the exact class name).

Now inspect the class of your "update col" link/button in list. It's something like "update_col-0"

And then you can have a css in your template custom.css file something like:

tr.yourelementclass_accept > td.fabrikActions > .btn-group > ul > li > a.update_col-0 {
display:none;
}

and

tr.yourelementclass_reject > td.fabrikActions > .btn-group > ul > li > a.update_col-0 {
display:none;
}

Exact hierarchy of elements/classes depends on whether you have the list buttons/links inline or in dropdown. Again, inspect with browser tool.

PS. that only hides the option, so wiser users might be able to overcome this restriction.
 
PS. that only hides the option, so wiser users might be able to overcome this restriction.
Yup.
To abort updates by "cheating" users I think you can additionally use the "Pre eval" code
 
Thanks juser.

I'm not able to do this. I've set the use as row class, and understood the concept.
Now, would it be feasible on the custom_css.php file? Or shall it be on the template file?

I was trying to use the custom_css file on the #/components/com_fabrik/views/list/tmpl/bootstrap folder (which is the template for the list frontend) like this:

Code:
#listform_$c .update_col-0_Accepted > td.fabrikActions > .btn-group > ul > li > a.update_col-0 {
display:none;
}

or

Code:
#listform_$c .update_col-0_1 > td.fabrikActions > .btn-group > ul > li > a.update_col-0 {
display:none;
}


I have this classes on the list:

Code:
<a type="button" class="btn update_col-0 listplugin btn-default" data-list="76_com_fabrik_76" title="Accept">
Code:
<a type="button" class="btn update_col-1 listplugin btn-default" data-list="76_com_fabrik_76" title="Accept">

The status element is a dropdown with this settings:
upload_2020-7-14_14-39-0.png

But no luck.
 

Attachments

  • upload_2020-7-14_14-37-20.png
    upload_2020-7-14_14-37-20.png
    7 KB · Views: 76
I think you have a problem in your css hierarchy. I'm using custom.css file in my template folder, so I have no "#listform_$c".

You just have to examine the element structure and go from top to bottom.
css.png


In this example you would need to have something like:

.progress010 > td > .btn-group > .update_col-2 {
display:none;
}
 
OK, I see I wasn't clear when saying that I use to change the custom_css.php file of Fabrik List/Form and not the Joomla Template one.

So, I assume I'll have to do this there.

@troester , Is there a way to accomplish this on the Fabrik custom_css.php file?

Thanks in advance.
 
No, it's not the Joomla template file I was talking about. What I meant was custom.css file in /components/com_fabrik/views/list/tmpl/your_template_name.

You can use the custom_css.php file instead. This file is basically the same as custom.css, but with more advanced capabilities as you can use php there.
 
As @juuser said: inspect your browser elements for exact classes and html tags.

It should be something like (with #listform_$c or e.g. #listform_13_com_fabrik_13 if you only want it for your list ID 13)

#listform_$c tr.yourelementclass_reject td .update_col-0 {
display: none;
}
This should be specific enough.
 
OK, thanks to both @juuser and @troester.

I've ended up doing a mix of the solution, using the custom_css.php file with the #listform_xx_com_fabrik_xx method.

#listform_xx_com_fabrik_xx tr.status2> td.fabrik_actions > .btn-group > .update_col-0 {
display:none;
}

The problem is that I was trying to use tr.status_value but, what it worked, was to have the tr.status01 or tr.status02 ( without the _ ) .

The custom.css file didn't worked anyway, I can't tell you why.

But it's solved now. Thank you guys.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top