View Full Version : [DUP] Hidden Field Values

23 Aug 2012, 4:45 AM
It is not possible to add a simple JS variable as value for a hidden field, Architect wrap the variable with 'variable' and after this the variable is a string. Is the a fix or a workaround?

23 Aug 2012, 1:50 PM
Set your value in an event handler or override.

We do not yet support JavaScript expressions in the property grid.

27 Aug 2012, 11:51 PM
its no expression, i just want to add

xtype: 'hiddenfield',
name: 'deviceId',
value: deviceID

where the value is an id. But if i add this variable to value inside of architekt i get this as value

value: 'deviceID'

and after that the variable is a string that i can not use.

Is that correct?

28 Aug 2012, 7:32 AM
A variable is an expression. We aren't able to determine when you want to use this value as a variable or just a raw string.

We are aware that this is an issue and are working to resolve it.

28 Aug 2012, 11:59 PM
And how should i do this with an event handler?

Or with overriding? I am a sencha newbie sorry.

29 Aug 2012, 5:00 AM
Add an afterrender event handler (for example) on the form, that does something like this (abstractComponent should be the name of the first argument to the event handler, change it if the auto-generated function uses something else):

abstractComponent.setValues({deviceId: deviceID});

This assumes "deviceID" is a global variable, which is probably not a good idea.

Also, this should probably go in a controller or something else. I chose the afterrender event because it will only fire after the field you want to modify actually exists.

On second thought, you could add an afterrender (or which ever) event handler directly on the field itself and just setValue(deviceID) in it.