Update databasejoin element data in repeat group on form submit

startpoint

Active Member
Hi,
I tried to update value with following code:
PHP:
$v = array('test');
$formModel->formData['table___element_name']=$v;
$formModel->formData['table___element_name_raw']=$v;
or
PHP:
$v = array('test');
$formModel->updateFormData('table___element_name'), $v, true;
$formModel->updateFormData('table___element_name_raw'), $v, true;
This code run in php form plugin during Start on form submission (onBeforeProcess).
The value in database not updated.
The result is the same when code run from php file.
If element is simple field the value updated successfully.

Tested on Joomla 3.8.3 and latest github update.
Where is my mistake or have a bug?
 
Try ...

Code:
$v=array('test');
$formModel->updateFormData('table___element_name' , $v, true);

... so that's 3 args to the updateFormData() method.

The last one says "also set the _raw to this", so no need to explicitly update the _raw as well.

-- hugh
 
Oh, just noticed the subject says "database join". In which case you'll need to use the value, not the label. So ...

Code:
$v=array('123');

... or whatever the FK value is for that.

-- hugh
 
I made a mistake by writing the code here and forgetting to mention that the element is in a repeating group.
This is a actual code:
PHP:
$v=array('1');
//$v=array(array('1'));
$formModel->updateFormData('repeat_group___dbjoin_elem' , $v, true);
Again not working.
 
If it's a repeat element, the formdata entry itself will be an array, with as many entries as there are repeats.

-- hugh
 
OK, I've narrowed down what's going on, but it's not an entirely trivial fix. It'd be nice if you could take out a sub for the month to help out with the time needed to resolve it. I'll probably fix it anyway, but ... gotta pay the bills somehow ...

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

Thank you.

Members online

Back
Top