Hide field in Edit saves it as NULL

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

Hide field in Edit saves it as NULL

Post by Satrapo »

Hello,

I add this code in EDIT PAGE -> Page_Render (v2024)

if ($this->PageID == "edit" && @$_GET['OffEdit']) {
                $this->fornitore->Visible = false;
                $this->prodotto_offerto->Visible = false;
}

It works and when users click on my custom edit kink (with ?OffEdit=1) the fields are hidden and users can edit only the others fields in the table.

The problem is that these field were filled before BUT they are saved as NULL

So setting a field
Visible = false;
in edit page set is value to NULL?
I need to hide some fields keeping values.

Thanks a lot!


mobhar
User
Posts: 11732

Post by mobhar »

You should assign those fields from Row_Updating server event by the old/existing value, for example:

$rsnew["fornitore"] = $rsold["fornitore"];
$rsnew["prodotto_offerto"] = $rsold["prodotto_offerto"];

Satrapo
User
Posts: 41

Post by Satrapo »

Ok but in row_updating I cannot evaluate @$_GET['OffEdit']

I can store it in SESSION variable in Page_Render and unset it in Row_updated or you have a better suggestion?


mobhar
User
Posts: 11732

Post by mobhar »

Your suggestion seems fine, you may simply use it.


Satrapo
User
Posts: 41

Post by Satrapo »

I'll do, thanks for your help!


Post Reply