hidden fields don't get updated

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

hidden fields don't get updated

Post by sticcino »

using a "add option" for an accounts for to add a "contact" record if needed.

have 3 fields
userid, datecreated, createdby that need to be updated but don't need to be displayed

after hiding them in page Render, the fields are not updated even even by adding default values in the page_render or page_load events as:
the page_Render is fired after the loaddefaultvalues(), so you'd think these would stick.
function Page_Render() {
$this->CreatedBy->Visible = false;
$this->DateCreated->Visible = false;
$this->_UserId->Visible = false;

	$this->CreatedBy->CurrentValue = CurrentUserID();
	$this->DateCreated->CurrentValue = CurrentDateTime();
	$this->_UserId->CurrentValue = CurrentUserID();        	

}

any way to update the fields with displaying them ?

thanks


arbei
User
Posts: 9409

Post by arbei »

Page_Render() is not fired when you insert/update, the script does not know the fields are made invisible, you may try Row_Rendered instead.


sticcino
User
Posts: 1043

Post by sticcino »

the xxx_addopt.php generated code does not have that event or many others, appears limited.


arbei
User
Posts: 9409

Post by arbei »

You may upgrade to v2019 which does support events in Add Option page.


mobhar
User
Posts: 11745

Post by mobhar »

Move this code from "Page_Render":
$this->CreatedBy->CurrentValue = CurrentUserID();
$this->DateCreated->CurrentValue = CurrentDateTime();
$this->_UserId->CurrentValue = CurrentUserID();

to "Row_Inserting" server event becomes:
$rsnew["CreatedBy"] = CurrentUserID();
$rsnew["DateCreated"] = CurrentDateTime();
$rsnew["_UserId"] = CurrentUserID();


sticcino
User
Posts: 1043

Post by sticcino »

thanks men,

i have v2019, just didn't dawn on me that the _opt.php would also use the class file.

crisis averted

thanks,


Post Reply