customize row id (Menu->Fabrik form->options)

miki

New Member
Hi,
I have a question trying to use an updating form.
Within the doc I found 2 chances "-1" & "-2".
But i need to set it like $my->company.

The full query is similar to:
select * where company.id = $my->company

Can anyone help me to find a way?

Thx a lot in advance,
Regards,
Michele
 
Last edited:
No, nothing built in to do that.

The way I'd go about it would be to use some PHP embedded in an article, using something like Sourcerer, do the database lookup to get your company ID, and generate a Fabrik content plugin string from that.

Code:
$myUserId = JFactory::getUser()->get('id');
if (!empty($myUserId)) {
   $myDb = JFactory::getDbo();
   $myQuery = $myDb->getQuery(true);
   $myQuery->select('companyid')->from('yourtable')->where('userid = ' . $myD->quote($myUserId));
   $myDb->setQuery($myQuery);
   $companyId = $myDb->loadResult();
   if (!empty($companyId)) {
      echo "{fabrik view=form id=123 rowid=$companyId}";
   }
}

Obviously change the table and field names and form id to suit.

-- hugh
 
ss1.jpg
Hi,
when I save the form a spinner starts and never ends... as in the picture attached.
Anyone know why and how to fix it?
Joomla 3.4.8
Fabrik 3.4.2

Thank you in advance.

PS I coded in this simple way:

{source}<?php
$company = JFactory::getUser()->get('company');
echo "{fabrik view=form id=1 rowid=".$company."}";
?>{/source}
 
Very likely something (an error message) in the network response breaking the expexted JSON string.
You can check with a browser dev tool.

company is no Joomla user element, I assume $company = JFactory::getUser()->get('company'); is throwing an error.
 
Hi troester,
I don't think so.
My code and the code suggested by hugh work out but show this bug, the same bug.
The record is updated, but the spinner dont stop running.
If I use the code posted by hugh same result...

I use also $company = JFactory::getUser()->get('company'); in other part of this Joomla site and no issues appear.

Perhaps something related to these plugins?
 
Is it working without sourcerer?
With sourcerer but with fix rowid?
Can you add access infos to your site infos?
 
Hi,
I tried to just use fabrik content plugin (no sourcerer) with no code and fixed id.
Same here, spinner doesn't stop.

I updated my sites info.

User "test" for Login in front end.
You can create your own user from front end as guest.
For new users I automatically create a new company entry, and update the user->company with the new company->id

If i try to load the company->(user->company) form the spinner starts after form submitted.

Thanx in advance.

Michele
 
On my site I see first the spinner, then spinner is closing and I get the popup/alert "Record added..."
On your site it's showing first the popup altert, then the (sticky) spinner
 
I create a new list pointing to the same MySql table with name "company".
So I use a new & clean form without settings, duplicate the menu item and point the second item to this new form with component plugin and same form id.

Now no spinner appears! So probably some settings generate the error.

But now after press save, a popup inform me that a record was insert/update, but the fields are now empty after submitting the form.
Do you have any trip to leave the fields filled?

Thx
 
But now after press save, a popup inform me that a record was insert/update, but the fields are now empty after submitting the form.
This is how it is on my site.
It's somehow redirecting to a new form (although the rowid is fixed set in my article).
I assume it's doing like the defaults in the redirect plugin ("Reset = yes" in Module/Content plug-in redirect options).

You can add a redirect plugin to your form, redirecting to your article and in the options set Reset=no and Content redirect = same page.
Maybe a redirect plugin with these settings would also solve the spinner issue in your other form.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top