Page 1 of 2

button to start report with launch form

Posted: Mon Apr 16, 2018 6:28 pm
by Henk_2a
Hello all

I made a php-procedure which runs a FPDF-report.
procedure.jpg
This procedure requires a launch-form to make some selections.
launchform.jpg
When I run the procedure with the run-procedure-button on the home screen everything goes ok.
Then I made a run-button,
button.jpg
When I run the procedure with this button I tried two options,
1 run the procedure, but then the procedure skips the form
2 run the form, but then it gives a blank screen
screen.jpg
So both options fail.
Then i tried the nurunphp onclickevent but that didn't solve the problem

Any idea what I did wrong? Thanks for your answer.

BTW I had the "ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER" error, I skipped this part but now I am always afraid that is the reason for all my problems ;-)

Re: button to start report with launch form

Posted: Tue Apr 17, 2018 12:55 am
by admin
Henk_2a,

nuBuilder Forte already has a Report Builder.

I don't understand why you are using FPDF.

And so I don't understand what you are trying to do.

Steven

Re: button to start report with launch form

Posted: Tue Apr 17, 2018 6:41 am
by toms
Hi,

Regardless of which PDF library to use, the question is how to execute a procedure from a run button.
"Run procedure" calls an internal function nuGetPHP(f, r).

There are two parameters to pass:

f: Launch Form Id (see table zzzzsys_form)
r: zzzzsys_php_id (see table zzzzsys_php)

What remains is to modify the button's onclick handler so that nuGetPHP() is called.

Re: button to start report with launch form

Posted: Tue Apr 17, 2018 9:33 am
by Henk_2a
admin wrote:Henk_2a,

nuBuilder Forte already has a Report Builder.

I don't understand why you are using FPDF.

And so I don't understand what you are trying to do.

Steven
Hi Steven
I use nuBuilder a few years now and I have build about 10 different applications. That is not because I hate nubuilder, that is because I love to work with it.
I know of your reportbuilder and yes, I use it a lot. But sometimes it simply isn't advanced enough and sometimes I need a fully controllable reportwriter, like FPDF.
That's why.

Anyway, thanks for your product, I like it.

Re: button to start report with launch form

Posted: Tue Apr 17, 2018 9:39 am
by Henk_2a
toms wrote:Hi,

Regardless of which PDF library to use, the question is how to execute a procedure from a run button.
"Run procedure" calls an internal function nuGetPHP(f, r).

There are two parameters to pass:

f: Launch Form Id (see table zzzzsys_form)
r: zzzzsys_php_id (see table zzzzsys_php)

What remains is to modify the button's onclick handler so that nuGetPHP() is called.
Hi Toms
thanks for your response.
Whatever I do, the object-builder demands me to enter a 'Run', and there I entered the name of the procedure.
I found your id's, and entered them in the onclick handler. (I think you meant nuRunPHP instead of nu GetPHP?) But it looks like this onclick event is completely ignored since nothing changes.
Isn't it I make some stupid misinterpretation?

I tried to insert screenshots, but the only thing I get in my previous post is the text 'Image' instead of an image :?

Re: button to start report with launch form

Posted: Tue Apr 17, 2018 10:05 am
by toms
You'll need to override the button's onclick handler, otherwise the button's default action is called and the form is not shown.
The function to run is really called "nuGetPHP" (although the function does not do what it claims)

Add this to your userhome's JavaScript field or under setup -> header.

Code: Select all

if (nuFormType() == 'edit') {
      $("#TestRunPHP").attr('onclick', '');  // <-- id of your button, disable the default onclick handler
        $("#TestRunPHP").click(function() { // <-- id of your button, add your own handler
                         nuGetPHP('5a543df52a0b944','5ad57cfdcb21bc8'); // <- replace with your ids
        });
}

Re: button to start report with launch form

Posted: Sun Apr 22, 2018 2:41 am
by admin
Henk_2a,

Can you try posting your screenshot again?

Steven

Re: button to start report with launch form

Posted: Mon Apr 23, 2018 7:43 pm
by Henk_2a
I succeeded in inserting them in my first post, however, the images are quite big ......
I hope this helps

Re: button to start report with launch form

Posted: Mon Apr 23, 2018 8:04 pm
by toms
Have you tried my suggestion?

Re: button to start report with launch form

Posted: Mon Apr 23, 2018 9:50 pm
by Henk_2a
yes, but no success, I don't understand where to put what code
you said
if (nuFormType() == 'edit') {
$("#TestRunPHP").attr('onclick', ''); // <-- id of your button, disable the default onclick handler
$("#TestRunPHP").click(function() { // <-- id of your button, add your own handler
nuGetPHP('5a543df52a0b944','5ad57cfdcb21bc8'); // <- replace with your ids
});
}
I made that
if (nuFormType() == 'edit') {
$("#TestRunPHP").attr('onclick','id of my button' ''); // <-- id of your button, disable the default onclick handler
$("#TestRunPHP").click(function() { // <-- id of your button, add your own handler ???? now where to add what?
nuGetPHP('id_form','id_procedure'); // <- replace with your ids
});
}

sorry for my ignorance, my js-knowledge is very low