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

Content plugin - Save foreign id

mariluzrm

Member
Hello everyone.
I am using the Fabrik content plugin. I have an article with a form and a list (this list is a 1: N relationship of the form record). When adding a new record to this list, it adds it perfectly to the database (using Add + default Save button), but as an external id it puts 0 instead of the foreign id (id of the form's record). How can I get it to be filled out correctly?
Thanks in advance.
 
How do you set the recordID of the form in the article?

You can use "Default" with eval enabled in your foreign key element to fetch the recordID of the related form (e.g. from the URL).
 
Hello.

The article is:

{fabrik view=form id=1 rowid=[param1]}

{fabrik view=list id=2 invent___IDESTR=[param1]}}


But when I add a new record in the list, when I'm in form (empty form to fill data), I have lost de invent___IDESTR (foreign ID) (I've tried to use php form plugin, and take this field with $formModel->getElementData, and then $formModel->updateFormData, but invent___IDESTR is cero, because it is a new record and foreign key is empty).

I can't do it. I am very new to Fabrik.

I don't understand how to do:

You can use "Default" with eval enabled in your foreign key element to fetch the recordID of the related form (e.g. from the URL).

Thanks
 
Hi.

I have chosen element_calc to the field INVENT___IDESTR and I have written in Calculation (Is it OK?):

return FabrikHelperElement::filterValue(INVENT___IDESTR);

And this message appears:

Update field structure for `IDESTR` from INT(4) to TEXT.


with this in Calculation:

return (int)FabrikHelperElement::filterValue(INVENT___IDESTR);

But It's appears the same message:

Update field structure for `IDESTR` from INT(4) to TEXT.

Or is it correct instead?

return FabrikHelperElement::filterValue(param1);


Thanks
 
Last edited:
I have chosen element_calc to the field INVENT___IDESTR and I have written in Calculation (Is it OK?
NO! The foreign key should be a field (or maybe databasejoin) element and you should set the element Default.
Get the element's filter value (top)
Say you filtered a list on an element, then went to add in a new record. Wouldn't it be great if the filtered element's value matched the selected filter? To achieve this enter the following in the element's default field:
PHP:
return FabrikHelperElement::filterValue(8);

Replace the 8 in the above example with your element's id.
http://fabrikar.com/forums/index.php?wiki/calculate-a-default-value/#get-the-element-s-filter-value
 
Sorry, but I'm in trouble ...
When you talk about "element Default", what do you mean? It is not enough to put in the element that is the foreign key (INVENT___IDESTR) :

  • Plugin=field
  • EVAL=yes
  • Default (php code)= return FabrikHelperElement::filterValue(41); //id element INVENT___IDESTR =41

Or I need to create a additional "element Default" (I don't know what it is) to pass the INVENT___IDESTR value and later assign that value in the form (new record) using php form plugin???

I don't get it. Please help!!!
 
  • Plugin=field
  • EVAL=yes
  • Default (php code)= return FabrikHelperElement::filterValue(41); //id element INVENT___IDESTR =41
Yes, this is what the WIKI says.
 
Hello.

It doesn't work for me, when I create the new registry it keeps putting the foreign key with the value 0, is it necessary to do something else?

I have debugged with eclipse and the function filterValue returns False

Also, again the message is displayed:
Update field structure for `IDESTR` from INT(4) to TEXT.

Thanks in advance.
 
Last edited:
Ok, it seems filterValue doesn't do in content plugin.

You can add a custum Add link in list settings and append the param there, something like (use your Add link)
index.php?Itemid=112&option=com_fabrik&view=form&formid=70&rowid=&param2={param2}

and then fetch the URL param in the default eval (only working if the user has Add access for this element)
Code:
$myapp = JFactory::getApplication();
$param = $myapp->input->get('param2','');
return $param;
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top