Showing a list within a form!

skyrun

Active Member
NOT... read my update below...

maybe i'm the only one that didn't realize you could do this, but in case it's useful and not obvious to others, you can display any fabrik list within a form (without modifying a template which would probably work too) using the fabrik content plugin and a 'dummy' calc element on the form.

i have posted this in f3.1.x forum which is where i am using it, but it should work on any fabrik version.

to do so, create a 'dummy' element on your form that is a calc element with a calculation of:
return '{'.'fabrik view=list id=4 listtablename___elementname={thistablename___elementname} showfilters=0'.'}';

of course replace the '4' with your list id and the element name you want to filter by with listtablename___elementname and the value for the filter coming from your form with thistablename___elementname (or that + _raw).

then turn on plugin processing for the form under 'options->process joomla plugins'. the default for a form is to process in details view only... so change it if you want the list to show up in your form.

i find this to be a useful way to show 'related data' when looking at the form. all links on the related data list work too!
 
UPDATE: well... i spoke too soon. using this approach (and i suspect putting it in the list in the template also) causes conflicts with the js... so it doesn't work because all of the js on the form (and the list) is broke when including the list on the form (including pressing the 'save' button...)

here's the js errors i get on chrome when the dummy element 'activities' on leads is published:
Code:
sf_lead___lead_quality_score attach to form:TypeError: Cannot call method 'addEvent' of undefined mootools-ext.js:115
Uncaught TypeError: Cannot call method 'get' of undefined dropdown.js:77
Uncaught TypeError: Cannot call method 'addEvent' of null list.js:1164

if this is a use-case that can be supported, looks like some work will need to be done to isolate the js on the form from the js on the list so it doesn't collide.

or perhaps someone could write a 'list' element type plugin that would display the list in an iframe (if perhaps that works to isolate js... i'm not sure) or some other way.
 
As the list is wrapped inside a <form> you can't then insert that in a another <form> - html won't allow for that. Perhaps your iframe idea would work, i've never tested that. I tend to place the list after / before the form
 
You can't include a list in a calc element (nested form tags), but you can include a list in form intro or outro (which are outside the form's "form" tag)
 
thanks, this is gorgeous! putting the list in the outtro (aka footer) works great. being able to do this will be very powerful on my app. thanks rob and troester.

so to summarize, put something like:
{fabrik view=list id=4 sf_activity___lead_id={sf_lead___id} showfilters=0}

in the 'footer' area of your form (with joomla plug-in's turned on) and voila, a list within a form (or details view).

perfect for any parent-child use case like a list of invoices under a customer so you can edit the customer on the form, then select individual invoices (children) under the customer (parent).

or tickets for a passenger, or reservations for a guest, or albums for a band (and songs for an album)... etc etc etc.
 
This worked great for me !

I have a page where employees authorize their weekly hours on a form. And, below the form I have included a list of past weeks so they can see previous info.

I wound up putting the form in the intro 'text' section of the list because I wanted to form on top.

I am also planning to use this a approach with a simple message system where people can use a form to enter and send internal messages, and can also see a list view of previous messages below the form...

Thanks and best regards,

- Jay
 
  • Like
Reactions: rob
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top