conditioned forms and lists

enzo2016

Member
Hi,
could a form presence be conditioned to the selection of a dropdown in another form?
Please imagine a related data example: schools fill the form 'schools' and the students fill the form 'participate'. A radiobutton into the form 'school' allows to the schools to choose if the students subscriptions can be sent online or not. If the school selects the "not online" option, then the related form and list shouldn't appear next to the correspondent record.
How could I get that?

Thanks

Enzo
 
In this example I mean the correspondent school. Hence some schools will have near a form button or list button and others not.

Thanks

-- Enzo
 
I still don't quite understand. Are you talking about when viewing the schools list, with a related data link to the students 'participate' list? So the related data link you are trying to hide is on the same list (schools) that the 'online' radiobutton is on?

If so, then yes, I can think of a way. You'll need to update from github to pick up this change I just made:

https://github.com/Fabrik/fabrik/commit/3a8ac7eb653ce30978fcfa100a08051911216188

... which adds the row data to the available data in the layouts that build those related data links.

Then you can override this layout:

components/com_fabrik/layouts/list/fabrik-related-data-view-button.php

... by copying it to either ...

./components/com_fabrik/views/list/tmpl/bootstrap/layouts/list
./templates/<your site template>/html/layouts/com_fabrik/list

... see wiki for explanation, the first one overrides it for just that list template, the second overrides all list templates.

Then at the start of that file, right after this line ...

Code:
$d = $displayData;

... add ...

Code:
if (isset($d->row->yourtable___online_raw) && $d->row->yourtable___online_raw == '0')) {
   echo "";
   return;
}

Replace yourtable___online_raw with the full element name of your radiobutton element (but keep the _raw on the end).

-- hugh
 
PS - that assumes that the radiobutton value for "No" (not online) is 0. If it's something else, change the '0' accordingly.

If you are using a yesno element instead of a radiobutton, the value for No will automatically be 0.

-- hugh
 
Yes, the related data link I am trying to hide is on the same list (schools) that the 'online' radiobutton is on.
I haven't yet tested out the procedure you suggested. I will do it next days. Here only some clarification:

In order to update from Github on local web, I will need: to download the zipped Github file; to unzip it on my pc; to delete Fabrik_build folder; Backup of my website; to replace (copy and replace) the unzipped content into Fabrik - fabrik - xxx
folder; to follow the Post Github update steps. I have only summed the procedure about the Github wiki. Is it correct?
Is the link you posted already included into the Github zip file?

When you write:
...see wiki for explanation
Is it referred to the template override wiki?


Thanks

Enzo
 
Yes, the link I posted is in the github zip. When you download the github zip, it's a "real time" snapshot of github. So anything which has been committed to github is there.

Yes, upload EVERYTHING from the zip to your site, in "always overwrite" mode (so don't use any features you ftp client might offer like "only overwrite if newer" or whatever). Or if you are copying locally rather than ftp'ing, make sure you say "yes" to overwriting existing files. You can skip the fabrik_build folder and the files at the top level if you want. Strictly speaking you don't have to do the post-update steps, if you are running the most recent build (3.5.1).

Uploading will take a while, as there are a lot of files. I think fabrik is now bigger than J! itself. Although a big chunk of that is 3rd party libraries, like DOMPDF (which has about 20mb worth of fonts in it), and some big 'composer' libraries used by various plugins.

-- hugh
 
When I tried copying fabrik-related-data-view-button.php into:
./components/com_fabrik/views/list/tmpl/bootstrap/layouts/list
I have noticed that I haven't a folder 'layouts' into the folder 'bootstrap'

Enzo
 
Nope, you have to create it. It's for optional overrides, doesn't exist in our installed folder structure, so we don't accidentally overwrite yours during updates.

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

Thank you.

Members online

Back
Top