Before SAVE Action - JSON Parse Failed

Before SAVE Action - JSON Parse Failed

Postby somnuk » Thu Jun 23, 2016 1:36 pm

In custom code Before Save Action, I have the following code.

if ('#accepted_date#' < '#reported_date#') {
$error='Accepted date must be greater than reported date'';
nuDisplayError($error);
return;
}
if ('#accepted_date#' == '#reported_date#') {
if ('#accepted_time#' <= '#reported_time#') {
$error='Accepted time must be greater than reported time';
nuDisplayError($error);
return;
}
}

It used to work before but suddenly it gave an error JSON Parse Failed. If I remove nuDisplayError() php function out. It works ok.
Any ideas???

2nd. Question. In addition, in the form I enable Print button. When I click on browse form, it causes an error as shown below.
How to correct this error? I noticed that it generate a table with empty column name. It is a bug or I must put some coding.


===USER==========

globeadmin

===PDO MESSAGE===

SQLSTATE[42000]: Syntax error or access violation: 1166 Incorrect column name ''

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

CREATE TABLE __576b5f9202ff6f6__ SELECT problem_id,IFNULL(no,'') AS ``,IFNULL(workorder_no,'') AS ``,IFNULL(DATE_FORMAT(reported_date,"%d-%b-%Y"),'') AS `` FROM problem ORDER BY workorder_no DESC, no ASC

===BACK TRACE====

D:\uwamp3.1\www\pm2\nuapi.php - line 333 (nuRunQuery)

D:\uwamp3.1\www\pm2\nuapi.php - line 244 (nuBuildTable)

D:\uwamp3.1\www\pm2\nuapi.php - line 84 (nuGetBrowseHTML)
somnuk
 
Posts: 1
Joined: Wed Jun 22, 2016 6:24 pm
Location: Thailand

Re: Before SAVE Action - JSON Parse Failed

Postby admin » Mon Jun 27, 2016 12:35 pm

somnuk,

If you look in the error log(..UwAmp\bin\apache\logs) you may find what the error is (probably a php error).

Steven
admin
Site Admin
 
Posts: 3406
Joined: Mon Jun 15, 2009 9:53 am
nuBuilder Version: 4.5

Re: Before SAVE Action - JSON Parse Failed

Postby hanstel » Tue Jul 05, 2016 6:59 am

this is related to my reported 'Undefined Error', has something to do with the nuBuilderPro's 'eval' call
hanstel
 
Posts: 28
Joined: Sat Apr 30, 2016 10:21 am


Return to Custom Code