Good evening,
I'm looking to create a global array of screen names (around 15) and then be able to loop through them in various functions.
Any pointers would be appreciated. Thank you,
james
Views
Replies
Total Likes
Hi James,
I'm guessing this will be a static array, that is there will be a fixed number of entries with fixed values.
Using a form variable you could set a value to an array literal and then use the eval function, so if the form variable ScreenNames had a value like ['s1','s2','s3'] then this would give you an array
var screenNames = eval(ScreenNames.value);
You could also put the array in a script object, but some earlier version of Reader used to drop script object variables (version 8.0 I think)
You could have multiple form variables with the same name (which you would have to do in the XML Source view) then you could use code like;
for (var i = 0; i < ScreenName.all.length; i++)
{
console.println(ScreenName.all.item(i).value);
}
You can also create a customs dataset.
I'm sure there are others, but I not sure what the best one would be, here's a sample form I used playing around with the options I new of, https://workspaces.acrobat.com/?d=G2aL1Tlmwo1ejDvbcGLmgA
Bruce
Views
Replies
Total Likes
That is the function i was looking for. Eval. Thank you Bruce I will try this and let you know if I'm successful!
james
Views
Replies
Total Likes
Hi Bruce,
I'm still having a bit of trouble.
I create my array in File - Form Properties - Variables.
Set the value to ['s1', 's2', 's3'].
Then on the click of a button I call,
xfa.resolveNode("NextSelection.caption.value.#text").value = eval(PageSelectionArray.all.item(1).value);
I'm assuming I either built the array wrong or I'm still accessing it wrong. Any help would be great.
james
Views
Replies
Total Likes
Hi James,
If you are going to use the eval approach then all you need is;
xfa.resolveNode("NextSelection.caption.value.#text").value = eval(PageSelectionArray.value)[1];
The "all.item(1).value" was for an alternative approach.
Sorry for the confusion.
Bruce
Views
Replies
Total Likes
Hi Bruce,
Works like a charm! Thank you again for the help
james
Views
Replies
Total Likes