Master/Detail disabled fields

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

Master/Detail disabled fields

Post by btrade »

Hi,

How i can to disable some fields in table Master (Master/Detail view page)? And i need for List Pages to save this fields.


mobhar
User
Posts: 11712

Post by mobhar »

Did you mean "disable" in "Master/Detail View" page is to hide the fields? If so, then you may simply use "Page_Load" or "Page_Render" server event that belong to the related master table's View Page, in order to hide the fields.

For example, in the demo project, you want to hide "CustomerID" field in "Master/Detail View" page of "orders" (master)/"orderdetails" (detail) tables, then simply put the following code in "Page_Load" server event that belongs to the View Page of "orders" table:

if ($this->getCurrentDetailTable() <> "") {
$this->CustomerID->Visible = FALSE;
}


btrade
User
Posts: 357

Post by btrade »

mobhar wrote:
Did you mean "disable" in "Master/Detail View" page is to hide
the fields?

Yes, I mean it.

$this->getCurrentDetailTable() is empty and filds not hide.

Why $this->getCurrentDetailTable() be empty?


mobhar
User
Posts: 11712

Post by mobhar »

btrade wrote:
Why $this->getCurrentDetailTable() be empty?

It will return an empty string if the current page does not contain its detail table.

mobhar wrote:
in "Page_Load" server event that belongs to the View Page of "orders" table:

Make sure you have already put that code in "Page_Load" server event that belongs to the "View Page" (as you mentioned in your first post above), and NOT in the "List Page".


btrade
User
Posts: 357

Post by btrade »

I do it as you wrote, but i have an empty result.

I make now and it works as i need:
I Create in Custom View for order (master table) a field of @name as f1
In Row_Rendered() for order (master table)

if (CurrentPageID() == "list") {

	$this->f1->ViewValue = '<h4>#'.$this->projects_id->CurrentValue.' / '.$this->title->ViewValue.' / ' .$this->status->ViewValue.'</h4>';
}

In (for order (master table) ) CustomTemplates -> Master Record Page -> CustomTemplate

<div {{{row_attrs}}}>
<div class="data">
<div>{{{value f1}}}</div>
</div>
</div>

Thanks you


mobhar
User
Posts: 11712

Post by mobhar »

btrade wrote:
I do it as you wrote, but i have an empty result.

It should work, as I tried it, and the field is hidden when the "Master/Detail View" page is being displayed. The field is shown back, when the single "List Page" of master table is being displayed.


Post Reply