Programmatically Control Field's Value

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
aldo
User
Posts: 8

Programmatically Control Field's Value

Post by aldo »

Hi, I just started using PHPMaker today. I basically needed to manipulate a variable's field value from the database. For example, before the record is displayed to the front end, change the field value not in the database but what it displays to the user.

Say the actually field value is 'over_50' ... if this is the case instead of showing over_50, change it to Age 50 and Over. In Codecharge I could do this in the Before Show Event using

global $users;
 if (($users->age->GetValue() == 'over_50')  {
$users->age->SetValue('Age 50 and Over');
 } 

Not that the code above has any reference to PHPmaker, but wanted to get the message across.

Thanks


mobhar
User
Posts: 11726

Post by mobhar »

You may simply use Row_Rendered server event, for example:

if ($this->age->CurrentValue == 'over_50') {
    $this->age->ViewValue = 'Age 50 and Over';
}

aldo
User
Posts: 8

Post by aldo »

Thanks, this is great!


Post Reply