Page 1 of 1

Programmatically Control Field's Value

Posted: Fri Mar 15, 2024 10:47 am
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


Re: Programmatically Control Field's Value

Posted: Fri Mar 15, 2024 11:00 am
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';
}

Re: Programmatically Control Field's Value

Posted: Sat Mar 16, 2024 3:05 am
by aldo

Thanks, this is great!