I’m developing a web app with PHPMaker 2021 to manage personal expenses.
I have written code for Expense Item View Page - Custom Template and there, I’ve added a button that takes me to “Add Category” page.
Here, what I want to achieve is…
Show the “Add Category” page in Modal Dialog.
Close the Modal Dialog upon Category added.
Redirect the User back to the view page which opened the modal dialog.
I enabled “Modal” for “Add Page” for Categories and copied the code for "Add Button on the List page for Categories to my Custom Template. This is opening the “Add Category” page in Modal correctly.But I am not sure how to solve the remaining two ToDo items.
I tried Page Redirecting, but I’m not sure how to detect if the add action is performed or otherwise. I tried $this->isInserted() for New and $this->isUpdated() for Edit etc, but that didn’t work for me, perhaps it does not work for forms in Modal dialog?
Please help me with the right way to implement modal dialog in the custom template that closes itself upon successful action (or if the User clicks the cancel button).
Also, please help me with the right way to show the modal dialog that does not close automatically if the User accidentally clicks in the area around the modal dialog.I understand, that currently it is version 2022. But I hope someone will help me with version 2021.
the right way to show the modal dialog that does not close automatically if the User accidentally clicks in the area around the modal dialog.
Since PHPMaker v2021 used Bootstrap v4, then you may simply put this following code in Client Scripts → Global → Pages with header/footer → Global Code:
For PHPMaker v2022, which used Bootstrap v5, you may simply put this following code in Client Scripts → Global → Pages with header/footer → Global Code:
Thanks so much for the link. That helped me a lot to correct my modal dialog code.
However, I noticed a new problem with Modal Dialog.When I load a Master-Detail Form for Edit with “show_detail=
” in Modal Form, the Look-up code to populate the drop-down of the detail page does not work. The drop-down is indeed filled well with values from the look-up table for the existing rows. But, when I click the plus button to add a new row, the drop-down in the newly added row in the detail table does not load Look-up values from the table in the drop-down. The drop-down appears empty.Is there any workaround for this?