Hide detail field in master detail add

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

Hide detail field in master detail add

Post by philmills »

I'm trying to hide a field in the detail table when using Master/Detail add (URL MyMasterTableAdd?showdetail=MyDetailTable)

In Page_Render for list of the detail table I tried adding this:

if ($this->CurrentAction == "gridadd") {
    $this->YourFieldName->Visible = false; // adjust YourFieldName to your actual field name
}

But it does nothing.
Any ideas?

v2023


mobhar
User
Posts: 11732

Post by mobhar »

Try Page_Load server event instead.

In addition, make sure you have already adjusted YourFieldName to your actual field name.


philmills
User
Posts: 559

Post by philmills »

In detail table > List Page > Page_Load I have this

		if($this->CurrentAction == "gridadd"){
			$this->Cancel->Visible = FALSE;
			$this->Notes->Visible = FALSE;
			$this->Completed_Date->Visible = FALSE;
		}

It still doesn't work...


mobhar
User
Posts: 11732

Post by mobhar »

Make sure you have already re-generated ALL the script files, at least for the current master and detail table files.


arbei
User
Posts: 9390

Post by arbei »

philmills wrote:

(URL MyMasterTableAdd?showdetail=MyDetailTable)

You are not in the Grid-Add mode of the List page (but in the Add page) of the master table, you may add your server event to the Add page of the master table or to the Detail Grid Page of the detail table.


mobhar
User
Posts: 11732

Post by mobhar »

The detail table is actually in gridadd mode for such case.

I tried Master/Detail Add with demo2024 project, for orders and orderdetails tables, with the URL ordersadd?showdetail=orderdetails.

I put this code in Page_Load server event that belongs to the orderdetails table:

if ($this->CurrentAction == "gridadd") {
    $this->Quantity->Visible = false;
}

and it works as expected. The Quantity field is hidden properly in detail table section of Master/Detail Add page.

If you want to test it quick, just add that code in the generated pageLoad server event that belongs to the models/OrderdetailsGrid.php file.


philmills
User
Posts: 559

Post by philmills »

It's working now thanks!


Post Reply