Expand my Community achievements bar.

Set different default values for table built using subforms

Avatar

Former Community Member
I'm using Designer 7.1 and need to have tables with a fixed number of rows, where the first column is readonly and displays a set of distinct values. For example



Body System Normal Abnormal Comments

-------------------------------------------------

Head

Neck

Respiratory

etc.



I'm constrained to building the table using subforms. I'd love to do it using the new table feature but this will not interface with our software.



I'm trying to put Javascript code in the Initialize section of the body subform that puts a different value in each row. I'm not finding a way to distinguish one row from the other. If I simply say



this.body_system.rawValue = 'Head'



Then all of the rows will have 'Head' in the first column.



I've tried the following but it doesn't work:



this.body_system.rawValue[0] = 'Head'

this.body_system.rawValue[1] = 'Neck'



Thanks for your help!

Peter
3 Replies

Avatar

Level 6
Set the value using the data DOM and the resolveNode method. For example, to set the value of the TextField1 object in the third instance of Subform1:



xfa.datasets.data.resolveNode("form1.Subform1[2].TextField1").value = "foo";



Jared Langdon

www.jlangdon.ca

Avatar

Former Community Member
That worked perfectly. I'd love to have figured that out myself but it must be buried in the help somewhere. Is there a good reference document for LiveCycle Designer Javascript? I've scoured around but could only find bits and pieces.



BTW here's the code that worked:



xfa.datasets.data.resolveNode("form1.TableParent.TableBodyRow[0].body_system").value = 'Head;

xfa.datasets.data.resolveNode("form1.TableParent.TableBodyRow[1].body_system").value = 'Neck';



etc.



Thanks so much!

Peter