Linking to custom user form from list - how?

redant

Member
Hi Everyone

I'm still trying to get my head around the way Fabrik does things so this may be an easy answer for someone who understands the structure better than me.

Objective: trying to link to a unique record from a list.

What I've done:
I have successfully created a custom link from a form to a list. The link parameters are correctly passed in the URL to the list page. I would now like to link back to a custom user information form from the list which has the corresponding userid.

I acheived this in the form with the redirect plugin but the redirect plugin is not available in the list. I understand this is due to some AJAX limitations / black magic :confused:

I have tried reading up on this is the forum and have tried implementing some of the suggestions but none of them link correctly. When clicking the button the user is directed to the following URL ../index.php/component/fabrik/details/5/3?Itemid=
(no Itemid) and an error message stating that the record cannot be found is presented.

The problem:
There is no Itemid being appended to the URL so it cannot find the record. Clearly there is something I am not seeing or understanding from the articles/posts which I have read.

Can someone please point me to a good tutorial on this or explain the steps to acheive this.

Thanks!
 
In list settings you can define custom links for add, edit, view buttons.
Itemid is the menu item it, not related to Fabrik records.

As custom links use "non-SEF" ones (with or without itemid)
index.php?option=com_fabrik&view=form&formid=70&Itemid=123
don't set a rowid, Fabrik will append it (assuming you are going to a form belonging to the same underlying database table, so rowids in your list are the same ones)

&view= form for form view
&view=details for details view
70: your form id
 
Hi troester

Firstly - thanks for the prompt reply. Appreciated.

I tried your suggestion but had the same result - no itemid being appended.

I also found this old post which you replied on way back when and which I somehow didnt find earlier: http://fabrikar.com/forums/index.php?threads/edit-link-or-button-in-detail-view.30112/ which basically gives the same instruction.

So just to be clear:
1. I have a form which when submitted uses the redirect plugin to take me to a list.
2. The list has a prefilter applied which runs a query and returns a dataset.

So - following your instruction I created a new list element for the list. I then:
1. Used the button plugin for Plug-in
2. Then in List View Setting -> List Settings
a. I set Link to details - yes
b. Enter the custom link in Custom Link

The result is a blank button with no icon still linking to the same URL: ../index.php/component/fabrik/details/5/3?Itemid=

Clearly there is something basic and fundamental I am missing here. Still reading and plugging away at it ... :rolleyes:
Thanks again
 
What did you put into the custom link?
As I've said:
Don't use SEF links, use the standard ones like
index.php?option=com_fabrik&view=form&formid=70&Itemid=123

The Itemid doesn't matter (it's the menu item id, no Fabrik row id)

In an element custom link you must append the rowid by yourself (my above example was for the custom links in the list settings, not in element's List view settings).
index.php?option=com_fabrik&view=form&formid=70&Itemid=123&rowid={rowid}
 
Thanks, troester

The thing that confused me was in the other post I mentioned previously, you mentioned "List view settings" which only appears under the button plugin. In the list view its under Links -> Custom Detail URL. At least I think that is the field you are referring to. I'm assuming that the field names were different in a previous version as the other post is from 2010 I see.

To answer your question - I am using the non-SEF format with the link format as you gave it, with my parameters obviously, e.g. 7 replaces your 70, etc. Now that I have the correct field it is rendering the form correctly without an error message but its still not linking to the correct form - I get a blank, "new" form instead of the form with the user's details pre-populated as I am trying to acheive.

So, with your help, I'm halfway there. Thanks!
 
There are two places you can set the detail link.

One is list wide, the Custom Detail URL, which overrides the default for the "Details" button/link for that list.

The other is set per element, under the element's List Settings, which will then turn the content of that element, in list view, into a clickable link.

But I'm not sure if that will work for a "Button" element. Try it with just a simple field element first, see if that does what you want.

-- hugh
 
Thanks, Hugh

The list view clickable link may in fact be a more elegant solution for the page once I can get the link to open the correct record. I think my problem is that I am not passing the record id correctly. I have tried your suggestion with just the field element and then with the list element, both with the same result where the page is rendering but the record is not being found.

I'm still getting used to/trying to understand, the structure of Fabrik afetr coding PHP directly in Joomla for many years. Once I "get it" I'm sure these things will be much clearer. Old dog - new tricks ....

thanks
Ant
 
What is the URL you are using for the element detail link. It should look like the second example in Troester's last post, with the &rowid={rowid} on the end.

--hugh
 
I have tried with &rowid={rowid} and without as well so that the url is auto appended. I also tried adding the menu id as a static link e.g. &rowid=4 but get the same result. However, I did discover that when I edit the link in the browser and I backspace to edit the link, when I delete the &rowid={rowid} at the end of the url, my browser ( testing on Edge at the moment ), burps, and shuts down. I then need to re-open the browser, log in and the change has not been saved. If I copy and paste the link from notepad++ this does not happen. It's the weirdest thing.

I have not had a chance to test with other browsers yet as my day job has been interfering :) but suspect that something got dinged somewhere and I'm pretty sure this anomaly is the cause of the unexpected behaviour with the link. I'll post back here as soon as I've had a chance to test my theory.

Fabrik staff and community are great. Really helpful. Appreciated. Thanks.
 
using &rowid={rowid} should definitely work. Maybe you managed to get some non-printing characters in that URL. Did you copy and paste it from somewhere?

-- hugh
 
Sorry for the late reply. Been down with flu.

Hugh, I'm not sure what the issue was with the browser closing. To answer your question, no I was not copying and pasting. I solved that issue by restarting the pc. I suspect a browser cache issue there as after the restart I was able to edit the field without it complaining.

As to my original issue - I have not found a solution yet but now that I'm back at my desk I will report a solution/ask for further advice here once I get back to that part of things.
 
Hi

This is definitely not working. I have followed the instructions above to the T and and I keep getting a new form - not the form with the fields pre-populated with the corresponding record as expected.

What I've tried:
1. Created a new site with a new database instance.
2. Created a new field in the database in both the tables named userid which I have manully appended to the url as well as using it as the {rowid} identifier and I still get the same beaviour
3. Created a hidden menu article and created the link as index.php?option=com_content&view=article&id=1&Itemid=113&rowid=1 - This shows the article as expected.

As time is now catching up to me on this project it looks like the only way around this is to point the link to an article and use DirectPHP with some custom code in the article to acheive what I'm trying to do.

Any other ideas would be welcome ...
 
Ah, OK, I may have misunderstood. I thought you were using the other lists normal primary key as the rowid.

If you want to link to a form using something other than the usual PK as the rowid, you have to add the special query string arg '&usekey=foo' where foo the the field you want to use as the key. So for example, on one of my test lists, I can link to the row which has a rowid of 4, and a user element called user_id with value 957, either as the normal ...

index.php?option=com_fabrik&view=form&formid=29&rowid=4

... or ...

index.php?option=com_fabrik&view=form&formid=29&usekey=user_id&rowid=957

And just for future reference, you can also use the special rowid -1, which means "user ID of the currently logged on user", so you can load a profile form for the currently logged on user as ...

index.php?option=fom_fabrik&view=form&formid=29&usekey=user_id&rowid=-1

-- hugh
 
Thanks, Hugh

Initially I was using the other list's PK as the rowid but in trying to get it to work I tried this other approach with a custom value.

I'll give this a try and revert.
 
Am I missing a very basic step in this process? Do I need to create a join between the list and the form?

Turning off SEF urls in joomla and manually adding in the values - e.g.
index.php?option=com_fabrik&view=form&formid=6&rowid=7 gives me the expected result.

However, if I run the process with the following in the custom detail URL:
index.php?option=com_fabrik&view=form&formid=6&rowid={rowid}

then the URL presented is:
index.php?option=com_fabrik&view=form&formid=6&rowid=1

If I add the URL index.php?option=com_fabrik&view=form&formid=6&rowid=7 into the custom detail URL then I also get the expected results.

So the conclusion is that the sql statement is firing correctly and being interpreted with the correct values. The issue is that using rowid={rowid} does not pass the expected value to the URL - it is passing 1 ( the rowid of the list row button being clicked ) rather than 7 ( the rowid of the form )

Clearly there is something very basic I am missing here.
 
Hi troester

the "7" in my example needs to come from the form I am trying to link to.

I'll try and explain what I'm trying to achieve again in a slightly different manner:-

I have a form = "form1"
I select some options from "form1" and click save.
The options are saved to the database table "form1" and a query runs based on the options selected.
The query runs against a table named "list1" (not the same table as form1) and ...
I am presented with a list with the results of the query.
------------ Things work fine up until this point -------------
I have another form = "form2"
"form2" contains saved details submitted by a user.
When I click on the view details button in "list1" I want to be presented with "form2"
------------This is where it breaks --------

I can set it up (it is not currently set up in this way) -
So that each table - "list1" and "form2" have a field named 'userid' which can act as the PK between the two tables.

Currently - using {rowid} I am presented with the table column field from "list1" (1) when what I actually want is the corresponding table column in "form2" (7)

Hope this makes sense?
 
Yeah, that makes no sense to me, can't picture what you are doing at all.

But basically, to create the link in the list, you need an element on that list which contains the FK (rowid) for the list/form you are linking to.

Table 1 ...
id (this table's rowid)
blah
table_2_id (FK to table 2, pointing to id of table 2)
blah

Table 2 ...
id (this table's rowid)
blah
blah

You can then link from rows on list 1 to forms from list 2 (assuming list 2 form is ID 2) by doing &formid=2&rowid={table1___table_2_id}

... or ...

Table 1 ...
id
blah
useird
blah

Table 2 ...
id
blah
userid
blah

... and doing &formid=2&rowid={table1___userid}&usekey=userid

-- hugh
 
Thanks, Hugh
Clearly my attempted explanations are confusing everyone. Sorry.

What I'm trying to do: (Lets use a rideshare type of example)
Form-"Select Destination" (on submit) -> Show pre-filtered details from List-"Drivers going to Destination" -> On click details show form-"Driver Details"

Hope that makes more sense? (Note to self: Less words = more clarity ;) )
 
OK, so really I would expect that on the "Drivers going to Destination" form you would have a join element which joins to "Driver Details", and you would use that as the rowid, like &rowid={drivers_going_to_destination___driver_id} or some such.

Here's an example:

http://screencast.com/t/quRl8sXrgHc

This is a "Movie Rentals" system I was building as an example for someone.

As you can see, the Movie Rentals table usually has the details link pointing to the rental record.

If I want that link to point instead to the Member details, for the member who rented, I have a join element (member_id), and I use that as the rowid, pointing to the member form (33 instead of 34).


index.php?option=com_fabrik&view=details&formid=33&rowid={kerry_rentals___member_id_raw}

So kerry_rentals___member_id_raw is the (raw) placeholder for the member_id on the rentals table. So I use that as the rowid, in a link to the members details page.

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

Thank you.

Members online

Back
Top