Global variable not updated in edit page

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

Global variable not updated in edit page

Post by Ren Lang »

A project has a global variable (named $qval ) witch we need to update in the Edit Page, if a value was changed in a combo box.
The code is:

function Form_CustomValidate(&$CustomError) {

if($this->fieldname->FormValue == 2){
$GLOBALS["qval"] = "xyz";
}
}

However, even being sure that the field value is '2' , the $GLOBALS["qval"] does not change to "xyz".

Could some expert show what we are doing wrong ?


mobhar
User
Posts: 11660

Post by mobhar »

Change:
if($this->fieldname->FormValue == 2){

to:
if ($this->fieldname->FormValue == "2") { // by default should be in string

If it still does not work, try to use "Row_Updating" server event instead:

if ($rsnew["fieldname"] == "2") {
$GLOBALS["qval"] = "xyz";
}

Please note that make sure "fieldname" is your actual field name. If not, then adjust it to your actual field name.


Ren Lang
User
Posts: 5

Post by Ren Lang »

tks


Post Reply