This following code will show you how to display the View/Edit page in modal dialog that belongs to another tables by using PHPMaker v2021. Actually, this trick is working also in v2020, but this time I obviously chose v2021, since I used the specific link to open the page in Modal dialog that only working in v2021 (which supports URL rewrite). If you want to implement this for v2020, then you need to adjust the url param from code below.
For simplicity, we need to use demo project that you may download and try by yourself for PHPMaker v2021: https://phpmaker.dev/demo2021.zip
So, we want to display Modal dialog to open View page of orders table for OrderID field from orders2 List page... and also open Edit page of customers table in Modal dialog for CustomerID field in orders2 List page.
Just copy this following code in Row_Rendered server event that belongs to orders2 table:
if (CurrentPageID() == "list" || CurrentPageID() == "view") { $this->OrderID->ViewValue = "<a href='#' onclick='ew.modalDialogShow({lnk:this,url: \"orders/view/".$this->OrderID->CurrentValue."\",btn: \"ViewBtn\"});'>" . $this->OrderID->ViewValue . "</a>"; $this->CustomerID->ViewValue = "<a href='#' onclick='ew.modalDialogShow({lnk:this,url: \"customers/edit/".$this->CustomerID->CurrentValue."\",btn: \"EditBtn\"});'>" . $this->CustomerID->ViewValue . "</a>"; }
Don't forget to re-generate ALL the script files, as usual. ;-)
Now login using username/password: admin/master from the generated web application, then go to orders2 List page. As you can see, when you click on link in OrderID from orders2 List page, it will open View page of orders table in Modal dialog
The similar thing also for CustomerID; will open Edit page of customers table in Modal dialog from orders2 List page.
As always, happy coding, everyone! :-)