Hi,
There's an Object with type "Select" on a form with an onchange event attached.
The PHP procedure does nothing but output a debug message: nuDebug("Dummy"). Actually, it can be replaced with any other code.
As soon as a value is selected from the dropdown, onchange is fired and hence the PHP code is executed.
Now here is the strange thing: The function nuBeforeSave(), that is declared in the form's javascript, is triggered somehow.
How can I prevent it from triggering? I mean no save action has happend at that time.
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.
nuBeforeSave triggered Topic is solved
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
nuBeforeSave triggered
You do not have the required permissions to view the files attached to this post.
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: nuBeforeSave triggered
Simplified example to replicate the issue:
1. In the Javascript section of a Form add;
2. Click the "Try me!" button
3. You'll see an alert 'uBeforeSave' because nuBeforeSave gets triggered for some unknown reason
1. In the Javascript section of a Form add;
Code: Select all
if (nuFormType() == 'edit') {
nuAddActionButton('nuRunPHPHidden', 'Try me!', 'nuRunPHPHidden("dummy")'); //-- run any php code (hidden)
}
function nuBeforeSave() {
alert("nuBeforeSave");
}
3. You'll see an alert 'uBeforeSave' because nuBeforeSave gets triggered for some unknown reason
Re: nuBeforeSave triggered
toms,
I have added a parameter for both nuRunPHP() and nuRunPHPHidden() that will allow you to ignore any nuBeforeSave().
http://wiki.nubuilder.net/nubuilderfort ... nPHPHidden
http://wiki.nubuilder.net/nubuilderfort ... t#nuRunPHP
Let me know if they work properly.
Steven
I have added a parameter for both nuRunPHP() and nuRunPHPHidden() that will allow you to ignore any nuBeforeSave().
http://wiki.nubuilder.net/nubuilderfort ... nPHPHidden
http://wiki.nubuilder.net/nubuilderfort ... t#nuRunPHP
Let me know if they work properly.
Steven
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: nuBeforeSave triggered
Steven,
I just tested nuRunPHPHidden() and nuBeforeSave() doesn't trigger anymore.
However, I find the description on the wiki not very clear. Looking at the source code, I figured that I can basically pass any parameter (like 1 to indicate true)
"string2 : optional, if this 2nd parameter is passed, any nuBeforeSave() function will not be run."
I just tested nuRunPHPHidden() and nuBeforeSave() doesn't trigger anymore.
However, I find the description on the wiki not very clear. Looking at the source code, I figured that I can basically pass any parameter (like 1 to indicate true)
"string2 : optional, if this 2nd parameter is passed, any nuBeforeSave() function will not be run."
Re: nuBeforeSave triggered
toms,
My fault, it was working the opposite way it was supposed to.
So the wiki should make sense now.
If you have a better explanation of how it works, I'll put that on the wiki.
I've updated Github.
Let me know if it works now.
Steven
My fault, it was working the opposite way it was supposed to.
So the wiki should make sense now.
If you have a better explanation of how it works, I'll put that on the wiki.
I've updated Github.
Let me know if it works now.
Steven
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am