Hello,
I have a bunch of fields on my_form, just for example here in this posting I am using US state names ....., say for example,
I have 3 fields, their names are as below
1) NY,
2) CA,
3) TX
I placed a hidden a text field, its name is GFL (i mean, Grey Fields List), am using this GFL for my programming purpose
From the back end (in our case, its an ERP -SAP) am populating/filling this GFL field, say for example.... its data looks like, CA TX (i mean, am concatenating the state names with a seperation of a space)
( FYI.....Already i have some JS piece in my_form INITIALIZATION and docReady events for some other purposes)
Now, my requirement is as below,
1) LOOP all the FIELD objects (here they are as State names) of my_form , then check whether their name (NY) existing in GFL's data..........if exisitng (in our case, its not existing) pls. greyed out with readOnly.......... if not existing
(in our case, its not existing) then skip the coloring and readOnly, go to next loop / iteration / state / Field
Actually, i can achieve my requirement by putting JS in each field objet's INITIALIZATION event itslef as below, (but, i have around 200 feilds in my_form, hence i would like to put at HEADER level by generically looping all the field objects in my_form in one piece of code),
For some other requirement one of expert has provided the below JS in these forums, as below
Actually, I tried to change the above JS as per my requirement, but its not working, pls. provide me correct JS as per my requirement
Thank you
Solved! Go to Solution.
Views
Replies
Total Likes
Try this:
function findNodes(vNode){
if (vNode.className === "field"){
if (vNode.isPropertySpecified("name")===true){
var myStateName=new RegExp(vNode.name);
var returnValue = GFL.search(myStateName);
if (returnValue!=-1){
this.ui.oneOfChild.border.fill.color.value="192,192,192";
this.access="readOnly";
}
else{
this.ui.oneOfChild.border.fill.color.value="255,255,255";//whatever colour is open access
this.access="open";
}
}
}
for (var a=0;a<vNode.nodes.length;a++){
findNodes(vNode.nodes.item(a));
}
}
findNodes(xfa.form);
Kyle
Views
Replies
Total Likes
Try this:
function findNodes(vNode){
if (vNode.className === "field"){
if (vNode.isPropertySpecified("name")===true){
var myStateName=new RegExp(vNode.name);
var returnValue = GFL.search(myStateName);
if (returnValue!=-1){
this.ui.oneOfChild.border.fill.color.value="192,192,192";
this.access="readOnly";
}
else{
this.ui.oneOfChild.border.fill.color.value="255,255,255";//whatever colour is open access
this.access="open";
}
}
}
for (var a=0;a<vNode.nodes.length;a++){
findNodes(vNode.nodes.item(a));
}
}
findNodes(xfa.form);
Kyle
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies