Page 1 of 1

Can't access variables of edit form in after save

Posted: Tue May 28, 2019 3:16 pm
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

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

Posted: Tue May 28, 2019 3:36 pm
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#

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

Posted: Wed Jun 05, 2019 9:50 am
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! :)