How to get the handle of all text fields in the subforms, using script

Avatar

Avatar

_jadobe_

Avatar

_jadobe_

_jadobe_

28-01-2009

Hi Friends,

I have around 20 fields in a subform, how can i get the names of all the fields using script.



I wish to enhance the following script where the field names are hard coded

thereby the script itself will get the names of the field names.



var f1 = this.parent.somExpression + ".TextField2" + ",";

var f2 = f1 + this.parent.somExpression + ".DropDownList1" + ",";

var f3 = f2 + this.parent.somExpression + ".NumericField1";

xfa.host.resetData(f3);



Any help will be greatly appreciated..



Thanks

JJ

Replies

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

29-01-2009

Instead of using this.parent.somExpression (this gives you the somExpression for the container object) just use this.somExpression and that will give you the somExpression for the object.



If you want to keep your code the way it is you can also use this.name to just get the object name.

Avatar

Avatar

_jadobe_

Avatar

_jadobe_

_jadobe_

29-01-2009

Hi Paul,

Thanks for your comments.

I achieved the clear contents by resetting, by taking input from your thoughts..



form1.sub1.sub2.sub3.table_1.addDelete_Top.addDelete.deleteRow::click - (JavaScript, client)

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

//Here is my code finally look like..

//row 1, table_1 are also subforms

for (var i=1;i<10;i++){

var myRow = this.resolveNode("table_1.row1[" + i + "]");

if(myRow.presence == "hidden"){

i = i-1;

var myRowDelete = this.resolveNode("table_1.row1[" + i + "]");

if(i!=0){

xfa.host.resetData(myRowDelete.somExpression);

myRowDelete.presence = "hidden";

}

break;

}

if(i==9){

xfa.host.resetData(myRow.somExpression);

myRow.presence = "hidden";

break;

}

}

//----------------------------------------------------------------



Thanks

JJ