Hello phpmaker expert,
May i ask a question. When i tried new feature modal dialog on add page it work.
But when we click at the gray background. It closed that modal form.
I found useful information that advice to set property of that modal form 'backdrop' : 'static'
Like this:
$('#myModal').modal({
backdrop: 'static', // This disable for click outside event
})
How to implement it to phpmaker project? Thanks.
Prevent close modal dialog
-
- User
- Posts: 37
Prevent close modal dialog
-
- User
- Posts: 980
This is old topic but I'm experiencing the same problem.
This code:
$(document).ready(function(){
$('#ewModalDialog').on("shown.bs.modal", function() {
$(this).data('bs.modal').options.backdrop = 'static'; // disable mouse click outside modal
$(this).data('bs.modal').options.keyboard = false; // disable ESC key
});
});
1-st line is ok but 2-nd line gives unexpected behavior, it only works on the second++ launch of the modal, don't work on the first launch.
Remove 1-st line, 2-nd line is ok. Vice versa.
So it's probably because backdrop and keyboard options should stick together as an array, fires in one line.
But I don't know, neither how to form the array using this approach, nor do the array method exist for this approach.
Please help.
Thanks.
-
- User
- Posts: 37
sorry for very very late respond mr sangnandar.
i had to work for some research project on my campus. hope you understand.
i tried this approach and solved my problem,
go to CLIENT SCRIPT->GLOBAL->PAGES WITH HEADER/FOOTER->STARTUP SCRIPT
document.getElementById("ewModalDialog").setAttribute("data-backdrop", "static");
document.getElementById("ewAddOptDialog").setAttribute("data-backdrop", "static");
hope it will help you too.
-
- User
- Posts: 11726
For PHPMaker v2020, you may simply put the following code into "Client Scripts" -> "Global" -> "Pages with Header/Footer" -> "Startup Script":
loadjs.ready("load", function() {
document.getElementById("ew-modal-dialog").setAttribute("data-backdrop", "static");
document.getElementById("ew-add-opt-dialog").setAttribute("data-backdrop", "static");
});