Page 1 of 1

Hide field in Edit saves it as NULL

Posted: Mon Apr 08, 2024 6:18 pm
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!


Re: Hide field in Edit saves it as NULL (v.2024.4)

Posted: Mon Apr 08, 2024 7:30 pm
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"];

Re: Hide field in Edit saves it as NULL (v.2024.4)

Posted: Mon Apr 08, 2024 10:08 pm
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?


Re: Hide field in Edit saves it as NULL

Posted: Mon Apr 08, 2024 11:44 pm
by mobhar

Your suggestion seems fine, you may simply use it.


Re: Hide field in Edit saves it as NULL

Posted: Tue Apr 09, 2024 12:16 am
by Satrapo

I'll do, thanks for your help!