This topic is locked
[SOLVED]

Pop up before report page displays

1/27/2025 9:15:21 AM
PHPRunner General questions
D
DealerModules authorDevClub member

I am trying to have a pop up show before a report page displays.

In the pop up, I would like to have the "date start" and "date end" prompts me to filter the reports page.

I have done some searching and I just think I am making this more difficult that it needs to be.

I have tried the Dialogue API without success.

Can someone point me in the right direction to handle this task.

Examples are always welcome.

Thanks!
Paul

Sergey Kornilov admin 1/27/2025

Dialog API seems like a reasonable idea here. What exactly did you try and what didn't work?

D
DealerModules authorDevClub member 1/27/2025

Hi Sergey,

I read through the Dialog API in the manual and the examples are referencing Inserting a Custom Button, with the tri-part events.

I am trying to get the dialog box to show before the report page actually is rendered so putting a Custom Button on the report page does not make sense to me.

What I tried was to Insert Custom Code Snippet in the Report.

My field is date_start

The custom code I tried was:

return Runner.Dialog( {
title: 'Select date to filter report.',
fields: [{
name: 'date_start',
type: 'date',
value: now(),
ok: 'Save',
cancel: 'Cancel',
beforeOK: function( popup, controls ) {
swal('Success', 'Selected color: ' + controls[0].val(), 'success');
}
});

Any help is greatly appreciated.

Thanks
Paul

Sergey Kornilov admin 1/27/2025

Paul,

you are still not saying what exactly is happening when you are trying to run this code.

D
DealerModules authorDevClub member 1/27/2025

What I have done as a work around until I figure out the Dialog API is:

Insert a custom button in the top of the report that calls the search page. I also removed the fields on the advanced search page that I did not need to show.

In the Client Before tab I entered:

location.href="employee_time_off_report_search.php";

I remove entries in the two tabs labeled Server and Client After.
This works but I wanted to learn how to get the Dialog API working because I think this is a powerful feature that I can use in other areas of the program as well.

img alt

D
DealerModules authorDevClub member 1/27/2025

I am getting an error stating the there is an unexpected '{' error and getting the red error band at the top of the page.
I must have something not formatted correctly in the code.

D
DealerModules authorDevClub member 1/27/2025

I put the code back in to get the exact error.

Parse error: syntax error, unexpected '{' in /home/utilsadmin/public_html/mywebsite.com/include/events.php on line 1634

Sergey Kornilov admin 1/27/2025

Thank you.

Dialog API is Javascript API for displaying dialogs. You cannot display a dialog from the server side code that is exactured on the web server.

Your code breaks because you are adding Javascript code to PHP event.

D
DealerModules authorDevClub member 1/28/2025

I should have known that!! Got to take breaks every now and then!
Thanks Sergey.