Modal custom window in custom files doesn't run (v2022)

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

Modal custom window in custom files doesn't run (v2022)

Post by gargiulo »

Hi,

i'm trying to transfer my old projects from v2021 to v2022 but i'm experiencing some unexpected result on my custom files. Let me explain in detail what happens

in the v2021 i had some custom files (.php) which had as content (in Custom Templates>Table specifics>Custom file>Content) just a simple lanch of .php file using include once=".......path of php file".

The php file was a simple modal window which appeared when from menu i clicked on the option linked to the custom file
the modal window appeared immediately and the HTML had a standard tag as :

<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">

now in v2022 it doesn't run anymore, the modal vindow doesn't appears and nothing happens

is there something i need to change in my tags or have i to generate some preliminar scripts

Thanks for your reply


arbei
User
Posts: 9288

Post by arbei »

  1. You may press F12 in your browser to check for JavaScript error and enable Debug to check for PHP errors in the log files.
  2. If you use HTML attributes to open the modal dialog, make sure you have set the required attributes correctly (you did not show you attributes in your code above), read Bootstrap 5.1 docs on Via data attributes.

gargiulo
User
Posts: 49

Post by gargiulo »

Thanks for the answer but :

when i use the HTML (e.g. button) i'm able to open the modal window but isn't my target.
in v2021 the modal opens without the button and i'm trying to do the same in v2022.

i tried to do it using js command as

var myModal = new bootstrap.Modal(document.getElementById('myModal'))
my-Modal.show()

but i receive (looking with F12 as you suggested) the error : Uncaught ReferenceError: bootstrap is not defined

So how to define correctly the bootstrap in order to make it running, really i don't know where and how

Could you be patient and address me

thanks in advance


arbei
User
Posts: 9288

Post by arbei »

gargiulo wrote:

var myModal = new bootstrap.Modal(document.getElementById('myModal'))
my-Modal.show()

  1. Remove "-" in my-Modal, (make sure you change the id to your real id, not just copy "myModal" from Bootstrap example)
  2. Add ";" after each line.
  3. Run your code after Bootstrap (and other JavaScripts) are loaded, see example 5 under Page_Head.
  4. Always press F12 in your browser to check for JavaScript error.

You better post your complete code for discussion.


gargiulo
User
Posts: 49

Post by gargiulo »

Hi,

thanks but it still doesn't run going in conflict with navigation bar.

Starting from he beginning my target is really very very simple :

  • in custom file v2022 i crerate a new file (e.g. MyOwnFileMain.php)
  • in content (Custom Template>Table Specific>Custom File>Content) i create a simple include_once "customphp/MyOwnFileStart.php";

And MyOwnFileStart.php simply is a modal window e.g. "Hello Word" , nothing else.

I'm not able to do this, can you help me in doing this simple coding

Thanks again


arbei
User
Posts: 9288

Post by arbei »

The view of the custom file is under <project folder>/views, if you include "customphp/MyOwnFileStart.php", make sure you put your include file in the correct folder, i.e. <project folder>/views/customphp/MyOwnFileStart.php.

View HTML source in your browser and make sure your include file is included.

Press F12 in your browser and go to the Console panel to check for JavaScript errors.

If problem remains, you may post the complete content of your MyOwnFileMain.php and MyOwnFileStart.php for discussion.


Post Reply