manipulating $rs in Recordset_Selected Event

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.

manipulating $rs in Recordset_Selected Event

Postby digitalphotoworld » Wed Jan 10, 2018 2:12 am

I try to modify the data in Recordset_Selected Event BEFORE anything is happen to the data. For this, I use the following code:

// Recordset Selected event
function Recordset_Selected(&$rs) {

while (!$rs->EOF) {
if ($rs->fields['color'] == 1)
$rs->fields['name'] = "red";
else
$rs->fields['name'] = "green";
$rs->MoveNext();
}
}

If I use var_dump($rs), I can see the raw data and that my changes are working well. But in Listpage the changes have no affect.

Is it not possible to change the data in this event? And if so, for what is this event good?
digitalphotoworld
 
Posts: 386
Joined: Wed Jan 09, 2013 12:26 am

Re: manipulating $rs in Recordset_Selected Event

Postby arbei » Wed Jan 10, 2018 11:41 am

You should change the ViewValue of the field in Row_Rendered Server Event instead of changing the rs.

Read the example in help file topic: "Server Events and Client Scripts" -> "Row_Rendered" for more information.
arbei
 
Posts: 1490
Joined: Wed Sep 09, 2015 10:13 am


Return to General Discussion (PHPMaker)



cron