Forums

HowTo update the model from a loop in CF7

ddipardo 08 Aug, 2020
I've created a form which contains a table list with a datasource read_data_test, with model name Test

I've added a loop with custom PHP code to calculate a result.

How do you update the value in the table list?

The PHP code below is executed in the PHP custom code of the Loop function.
$this->set("read_data_test.fieldname",$calculatedVar);
$this->set("Test.fieldname",$calculatedVar);
$this->set("Test[fieldname]",$calculatedVar);

None of those commands are updating either the read_data_test datasource or the Model.

Could someone point me in the right direction?

Thanks,
/D
Max_admin 16 Aug, 2020
You will need to update a variable before the loop then use the updated variable as the loop data source!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ddipardo 23 Sep, 2020
Could you please be so kind to give some example since it doesn't make any sense to me. It might be as well the lack of documentation as I have no reference on how to do this
ddipardo 23 Sep, 2020
By trial and error I figured out to write the read_data variable back after modification which did the trick
This topic is locked and no more replies can be posted.