I have several "reports" that are little more than lists (i.e no grouping, subtotals etc) and I achieve a two-column layout for longer lists by an unpleasant piece of code which creates report table #TABLE_ID# with duplicate columns and then shuffles data about.
Anyway, I have been fiddling around with CSS flex & grid layouts which provide an easy way to output a list into two columns. I have a PHP procedure which generates an HTML page but if I call it from nuAddActionButton then it doesn't work. It should output a page to a new tab like it does from the onclick event of a button (or as nuRunReport does from nuAddActionButton).
Would I be right in assuming this Behaviour of the RUN button is also my answer?
Neil.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
nuRunPHP in nuAddActionButton Topic is solved
-
- nuBuilder Team
- Posts: 4416
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 74 times
- Been thanked: 472 times
- Contact:
Re: nuRunPHP in nuAddActionButton
Hello Neil,
Are you calling nuRunReport() in nuAddActionButton() ?
Are you calling nuRunReport() in nuAddActionButton() ?
-
- Posts: 154
- Joined: Mon Dec 05, 2011 12:23 pm
- Location: Newton Abbot, UK
- Has thanked: 2 times
- Been thanked: 1 time
Re: nuRunPHP in nuAddActionButton
Yes, nuRunReport() working OK when called from nuAddActionButton(). i.e
So the nuRunReport produces its PDF output in a new window, and the nuRunPHP produces no output (the button remains "down" for a moment).
Code: Select all
if (nuFormType() == 'browse') {
nuAddActionButton('VehCheckRpt', 'Checklist', 'nuRunPHP("php_checklist")');
nuAddActionButton('VehInspections', 'Inspections', 'nuRunReport("rpt_inspections")');
}
-
- nuBuilder Team
- Posts: 4416
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 74 times
- Been thanked: 472 times
- Contact:
Re: nuRunPHP in nuAddActionButton
In a test form, I added this line of code.
And I created a procedure "php_checklist" with the code
When the action button is clicked, a new tab is opened and 123 is written to the document.
Do you do anything differently? Please provide step-by-step instructions on how to replicate it.
Code: Select all
nuAddActionButton('VehCheckRpt', 'Checklist', 'nuRunPHP("php_checklist")');
Code: Select all
echo "123";
Do you do anything differently? Please provide step-by-step instructions on how to replicate it.
-
- Posts: 154
- Joined: Mon Dec 05, 2011 12:23 pm
- Location: Newton Abbot, UK
- Has thanked: 2 times
- Been thanked: 1 time
Re: nuRunPHP in nuAddActionButton
I'm always too slow to delve into the console and debugger...
1) the console error is
2) This is from the nuBeforeSave() function which is being called:
3) nuajax.js has this:
I should read the docs more often - the third parameter has fixed this. Sorry for wasting time!
1) the console error is
Code: Select all
Uncaught TypeError: $(...).val() is undefined
Code: Select all
function nuBeforeSave() {
if ($('#veh_reg').val().indexOf(" ") > 0) {
nuMessage("No spaces allowed in registration number");
return false;
}
return true;
}
Code: Select all
function nuRunPHP(code, iFrame, runBeforeSave) {
if (runBeforeSave == undefined) {
if (window.nuBeforeSave) {
if (nuBeforeSave() === false) { return; }
}
}
...