Page 1 of 1

Subform not saving properly

Posted: Sat Apr 07, 2018 10:54 pm
by alf1976
my subform looks like this:
component.png
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)
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.
finish.png
Any help would be greatly appreciated.

Re: Subform not saving properly

Posted: Sun Apr 08, 2018 1:35 am
by admin
alf1976,

It could be because you have a Subform inside another Subform.

nuBuilder Forte can't do that.

BTW I like that style you have added.

Steven

Re: Subform not saving properly

Posted: Sun Apr 08, 2018 5:24 pm
by alf1976
Hi Steven,

There is no subform within a subform. If i could do that the design would have been be alot more elegant.
The subform does save around 68 fields . Could this be an issue? i tried to replicate with a far
more simplier example but that worked fine

Re: Subform not saving properly

Posted: Mon Apr 09, 2018 3:26 am
by shane
I think the problem is with the settings in your php.ini file.

You will need to increase the value for max_input_vars.

It is safe to add a couple of zeros to whatever your default setting is.

Don't forget to restart start apache after changing your php.ini settings

Re: Subform not saving properly

Posted: Mon Apr 09, 2018 9:25 pm
by alf1976
Hi Shane,

That worked. The default value was only set at 1000.
I would have never of thought of that.
Thank you very much.

Andrew

Re: Subform not saving properly

Posted: Mon Apr 09, 2018 11:10 pm
by admin
.