I have got a solution, only the last step is missing:
- all subforms of interest are named like this: "TFI_xxxx", e.G. "TFI_10_Info" or TFI_20_Info"
- all textfields of interest folltow this role: "ID_xxxx", e.G. "ID_10_Info" or "ID_20_Info"
The hirarchie is this
Formular1
+ Page_1
+ TF_Head
+ TFI_10_Info <== the subform I want to examine
- ID_10_Info <== the textfield I want ot change
- IE_10_Info
+ anotherSubform
+ TFI_20_Info <== the subform I want to examine
- ID_20_Info <== the texfield I want ot change
- IE_20_Info
- so there is always a structure a subform "TFI_xxxx" and a textfield "ID_xxxx", some 100 combinations .
- I want to access programmatically all text-fields "ID_xxxx" to change something like the rawValue.
- I need to access the textfields without knowing the "path" (hirarchie) to it
My Problem, where I need help
- I need to access the textfields without knowing the "path" (hirarchie) to it
I tried for 3 days now, somehow I am convienced that I am on the right track, just have not found my error
Thanks to any help!
Bruno
Hiere is my code, showing the error line ("//<<====?===== 1.st Try"), I get no object (== Null)
My Code
function allfields(Nodes){
try{
for (var i = 0; i < Nodes.length; i++){
var NodeName = Nodes.item(i).name;
var NodeLength = Nodes.item(i).nodes.length;
var NodeClass = Nodes.item(i).className;
var myTextfeld = xfa.resolveNode("#subform.Textfeld3");
// Subform TFI____
If(NodeName.indexOf("TFI_") >= 0 && NodeClass == "subform"){
// this is a subform, which has a name "TRI_xxxx"
var InfoFieldName = NodeName.substr(3);
var InfoDName = "Page_1.#subform." + "ID" + InfoFieldName ; //I think, I made an error here!
// we are in a node (subform) "TRI_xxxx"
// We can create the name of the underlying textfield (InfoDName): ID_xxxx
// InfoDName shows: "Page_1.#subform.ID_10_Info"
xfa.resolveNode( InfoDName).rawValue="Hallo" //<<====?===== 1.st Try
Nodes.item(i).nodes(InfoDName).rawValue="Hallo"; //<<====?===== 2.nd Try
}
//recursion for subforms only
if (NodeClass == "subform" ){
if (NodeLength > 0) {
func.allfields(Nodes.item(i).nodes);
}
}
}
} catch(err) {
var vDebug = "";
for (var prop in err) {
vDebug += "property: "+ prop+ " value: ["+ err[prop]+ "]\n";
}
vDebug += "toString(): " + " value: [" + err.toString() + "]";
var msg="in Level 1, dropdown\n";
xfa.host.messageBox( msg + vDebug);
}
}