This topic is locked
[SOLVED]

 hidefield won't update when save

1/4/2018 10:16:22 AM
PHPRunner General questions
J
jwehner author

I'm trying to set some fields and save them to a database using this code on the add page JavaScript OnLoad event:
var ctrl = Runner.getControl(pageid, 'ETL_NaturalKeyText');

ctrl.setValue("5493001WHVQBGRSWEU75NE022589364");

pageObj.hideField('ETL_NaturalKeyText');
when I remove the hidefield line it will save the record just fine. But when I have that line in it results in this error:
Source: Microsoft SQL Server Native Client 11.0 Description: Cannot insert the value NULL into column 'ETL_NaturalKeyText', table 'HMDA_DW_Staging.dbo.HMDA_Reporting_staging'; column does not allow nulls. INSERT fails. The statement has been terminated.
Any idea's why?

admin 1/4/2018

Hidden fields will not be submitted and will not be saved in the database.
Use events like BeforeAdd/BeforeEdit and the following code:

$values['ETL_NaturalKeyText']="5493001WHVQBGRSWEU75NE022589364";
J
jwehner author 1/4/2018



Hidden fields will not be submitted and will not be saved in the database.
Use events like BeforeAdd/BeforeEdit and the following code:

$values['ETL_NaturalKeyText']="5493001WHVQBGRSWEU75NE022589364";



Awesome! Thank You!

J
jwehner author 1/4/2018

well this works but it doesn't hide the field from display.
I don't want the user to see the fields but I want the values to be saved to the database.

J
jwehner author 1/5/2018



in add page "before display" even use the following code :

$pageObject->hideField("ETL_NaturalKeyText");



That works.. thanks much!

romaldus 1/5/2018

in add page "before display" even use the following code :

$pageObject->hideField("ETL_NaturalKeyText");