Saturday, March 23, 2019

Adobe Acrobat PDF javascript to check multiple checkboxes. via /r/pdf


Adobe Acrobat PDF javascript to check multiple checkboxes.

Currently the code is like this but it’s only doing the “str.” ones:

var stats = [ "str.", "dex", "sta", "cha", "ma", "ap", "per", "int", "wit" ]; var statsLength = stats.length; for (var i = 0; i < statsLength; ++i) { for (var j = 0; j < 90; ++j) this.getField(stats[i] + j).checkThisBox(0, true); } 

Not sure why. And yeah, that one in particular does have a “.” in its name.

Edit: I got it fixed. Solved. Here it is in case anyone else ever wants to do the same.

var state = this.getField("AtrAllChks").isBoxChecked(0, true); var stats = [ "dex", "sta", "cha", "ma", "ap", "per", "int", "wit" ]; var statsLength = stats.length; var numberFields = this.numFields; var statsRe = new RegExp("^(?:" +stats.join("|")+ ")\\d"); var strFields = this.getField("str").getArray(); var strLength = strFields.length; for (var i = 0; i < strLength; ++i) { strFields[i].checkThisBox(0, state) ; } for (var i = 0; i < numberFields; ++i) { var fn = this.getNthFieldName(i); if (!statsRe.test(fn)) continue; this.getField(fn).checkThisBox(0, state); } 


Submitted March 23, 2019 at 02:12PM by TiffanyGaming
via reddit https://www.reddit.com/r/pdf/comments/b4piae/adobe_acrobat_pdf_javascript_to_check_multiple/?utm_source=ifttt

from Medical Release Form https://medicalreleaseform.tumblr.com/post/183663699511
via Medical release form
from Tumblr https://jeemiahmelville.tumblr.com/post/183664075642

No comments:

Post a Comment