Subform not saving properly
Posted: Sat Apr 07, 2018 10:54 pm
my subform looks like this:
However if i then delete the contents of any any lookup fields (in the red box) and then save it fails and the subform reverts to the back to the original stored version. Once the subform has failed once it will not save properly again until i leave and re-enter the main record.
To try and debug the issue i added BeforeSave JavaScript event to the form dumping the nuSubformObject('EstimateComponents') to the console.log(). From this the correct fields are showing as being 'edited' but nuDebug error is:-
so even though fields have been edited there are no fields listed after the SET statement causing the SQL error
I use an identical method on the main record with exactly the same field structure and functions and these behave fine and do not cause any issue. It's just on the sub form where it is causing an issue. Any help would be greatly appreciated.
If i alter any of the input fields or change any of the lookups from blank to a value the subform saves correctly.However if i then delete the contents of any any lookup fields (in the red box) and then save it fails and the subform reverts to the back to the original stored version. Once the subform has failed once it will not save properly again until i leave and re-enter the main record.
To try and debug the issue i added BeforeSave JavaScript event to the form dumping the nuSubformObject('EstimateComponents') to the console.log(). From this the correct fields are showing as being 'edited' but nuDebug error is:-
Code: Select all
===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 'WHERE `EstCompID` = '17'' at line 1
===SQL===========
UPDATE EstComp SET WHERE `EstCompID` = '17';
===BACK TRACE====
/volume1/web/nuBuilder/nudata.php - line 320 (nuRunQuery)
/volume1/web/nuBuilder/nuapi.php - line 50 (nuUpdateDatabase)
I use an identical method on the main record with exactly the same field structure and functions and these behave fine and do not cause any issue. It's just on the sub form where it is causing an issue. Any help would be greatly appreciated.