Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Can't access variables of edit form in after save

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
mabe
Posts: 4
Joined: Tue May 28, 2019 3:03 pm

Can't access variables of edit form in after save

Unread post by mabe »

Hi there!

I have build a browse edit form.
After a user saves data, I want to execute a sql query which contains the values, that the user just entered.
However, I only get empty values using PHP:

Trying to execute this:

Code: Select all

$s = "insert into dashboard (id, project_name ) VALUES (" . nuLookupRecord()->id . ", '" . nuLookupRecord()->project_name . "');";
nuRunQuery($s);
...resolves with the following error:
[0] :
===USER==========

globeadmin

===PDO MESSAGE===

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' '')' at line 1

===SQL===========

insert into dashboard (id, project_name ) VALUES (, '');

===BACK TRACE====

/var/www/html/nubuilder/nucommon.php(1254) : eval()'d code - line 2 (nuRunQuery)

/var/www/html/nubuilder/nucommon.php - line 1254 (eval)

/var/www/html/nubuilder/nudata.php - line 365 (nuEval)

/var/www/html/nubuilder/nuapi.php - line 52 (nuUpdateDatabase)
Does somebody know, what I am doing wrong?
Thank you very much!

Cheers,

Malte
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Can't access variables of edit form in after save

Unread post by kev1n »

Hi,

nuLookupRecord() can only be used to return fields from a selected Lookup record.

Use Hash Cookies in PHP AS (After Save):
https://wiki.nubuilder.cloud/ ... sh_Cookies

e.g. #RECORD_ID# and #project_name#
mabe
Posts: 4
Joined: Tue May 28, 2019 3:03 pm

Re: Can't access variables of edit form in after save

Unread post by mabe »

kev1n wrote:Hi,

nuLookupRecord() can only be used to return fields from a selected Lookup record.

Use Hash Cookies in PHP AS (After Save):
https://wiki.nubuilder.cloud/ ... sh_Cookies

e.g. #RECORD_ID# and #project_name#
Thank you very much, now it's working perfectly! :)
Post Reply