Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
nuRunQuery is not defined
-
- Posts: 64
- Joined: Sun Jan 22, 2023 7:03 pm
nuRunQuery is not defined
Hi, I am new to nuBuilder.
I am trying to run a query in the Custom Code section of a form, but what I get is nothing at all.
This is the error message I find in the browser console:
418:8 Uncaught ReferenceError: nuRunQuery is not defined
at <anonymous>:8:15
at b (jquery-3.6.4.min.js?ts=1:2:866)
at He (jquery-3.6.4.min.js?ts=1:2:48496)
at S.fn.init.append (jquery-3.6.4.min.js?ts=1:2:49847)
at nuAddJavaScript (nuform.js?ts=20230409190610:5338:12)
at nuBuildForm (nuform.js?ts=20230409190610:169:3)
at successCallback (nuajax.js?ts=20230409190610:131:4)
at Object.success (nuajax.js?ts=20230409190610:15:41)
at c (jquery-3.6.4.min.js?ts=1:2:28447)
at Object.fireWith [as resolveWith] (jquery-3.6.4.min.js?ts=1:2:29192)
(
Can you help? Thanks
I am trying to run a query in the Custom Code section of a form, but what I get is nothing at all.
This is the error message I find in the browser console:
418:8 Uncaught ReferenceError: nuRunQuery is not defined
at <anonymous>:8:15
at b (jquery-3.6.4.min.js?ts=1:2:866)
at He (jquery-3.6.4.min.js?ts=1:2:48496)
at S.fn.init.append (jquery-3.6.4.min.js?ts=1:2:49847)
at nuAddJavaScript (nuform.js?ts=20230409190610:5338:12)
at nuBuildForm (nuform.js?ts=20230409190610:169:3)
at successCallback (nuajax.js?ts=20230409190610:131:4)
at Object.success (nuajax.js?ts=20230409190610:15:41)
at c (jquery-3.6.4.min.js?ts=1:2:28447)
at Object.fireWith [as resolveWith] (jquery-3.6.4.min.js?ts=1:2:29192)
(
Can you help? Thanks
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
Re: nuRunQuery is not defined
Hi,
nuRunQuery() is a PHP function, it can only be run in a BE, BS etc. event, not in the form's Custom Code.
If you want to run a query from JavaScript, you will have to call a Procedure with nuRunPHPHidden()
nuRunQuery() is a PHP function, it can only be run in a BE, BS etc. event, not in the form's Custom Code.
If you want to run a query from JavaScript, you will have to call a Procedure with nuRunPHPHidden()
-
- Posts: 64
- Joined: Sun Jan 22, 2023 7:03 pm
Re: nuRunQuery is not defined
Thank you so much for your prompt reply. Got it. It was a stupid question...
What I need to do is to have a given field in a form to default to a query result when I open that form to add a new record.
Any tip?
Thanks in advance
What I need to do is to have a given field in a form to default to a query result when I open that form to add a new record.
Any tip?
Thanks in advance
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
-
- Posts: 64
- Joined: Sun Jan 22, 2023 7:03 pm
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
Re: nuRunQuery is not defined
Either use nuOnProcessObjects() or nuAddJavaScript() in the BE (Before Edit) PHP event.
-
- Posts: 64
- Joined: Sun Jan 22, 2023 7:03 pm
Re: nuRunQuery is not defined
Me again...
I am trying to use the nuOnProcessObjects() method, but where and how should I define $f to get $f->objects?
Thanks
I am trying to use the nuOnProcessObjects() method, but where and how should I define $f to get $f->objects?
Thanks
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
-
- Posts: 64
- Joined: Sun Jan 22, 2023 7:03 pm
Re: nuRunQuery is not defined
OK. I am not a PHP geek, but the following BE code:
function nuOnProcessObjects() {
for ($i = 0; $i < count($f->objects); $i++) {
if ($f->objects[$i]->id == 'doc' {
$f->objects[$i]->value = 'myDummyText';
break;
}
}
}
cause the following error message (from browser console) in core/nuapi.php:1
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Where am I wrong?
function nuOnProcessObjects() {
for ($i = 0; $i < count($f->objects); $i++) {
if ($f->objects[$i]->id == 'doc' {
$f->objects[$i]->value = 'myDummyText';
break;
}
}
}
cause the following error message (from browser console) in core/nuapi.php:1
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Where am I wrong?
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact: