• 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.

Related data with conditions in the list view

zucchetti

Member
Hi!

I have a list, with forms added through related data, so that in the list view I have added buttons to four more forms. With help from the forum, I?ve managed to modify the list template to add a condition to show or not show the other buttons depending on how a yes/no element is set. That element belongs to the main form/list.

Now, I need the buttons to be shown depending on element values of previous forms. I ask people to complete the "main" form, then, if a cetrain element is set to a certain value, I want to show the next button (of the second form), then, if a cetrain element of the second form is set to a certain value, I want to show the button of the third form, then if a certain elemnt of the third form is set a certain value, I wan to show the buttons related to the fourth and fifth forms.

I hope I?ve made my point.

Thanks in advance.

PS: It?s the list id 55 from my registered site.
 
You'll have to figure out the query to do that.

How are the forms related? So if you are displaying form2, how do you know which row in form1 to check?

As an example, I'll assume they are related by a user element, so you want to find a value from form1, when rendering form2 ...

Code:
$myUserId = JFactory::getUser()->get('id');
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('somefield')->from('form1')->where('user_id = ' . $myDb->quote($myUserId));
$myDb->setQuery($myQuery);
$somevalue = $myDb->loadResult();

You can then use $somevalue to decide whether to show the link or not.

If it isn't user ID, you'll need to explain how the rows are related across tables. Like, for instance if you have a table1_id on table2, that points to the rowid in table 1 associated with this table2 row.

-- hugh
 
Thanks for your answer.

The relation between the forms is not exactly by user.
I have made databasejoin elements in forms 2, 3 , 4 and 5 that take information from an element in form 1.
 
So forms 2, 3, 4 and 5 are related to form 1? So you have joins on those that point to the 'id' (primary key) of form 1?

The more information you give me, the better I can help.
 
Exactly, I ask people to complete an element in form 1, and then I?ve made databasejoins to keep using that information in the rest of the forms. In all my databasejoins I use the table that saves form 1, the value id (recommended) and the tag id.

The thing is that I don?t know if it is possible to make conditions in the list template regarding elements that don?t belong to the "main form(1)"
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top