These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Check all check boxes to see which ones are checked

StevenD
Registered: Oct 6 2006
Posts: 368
Answered

I'm trying to figure out how to run through the field in a form to determine if a field is a checkbox and if it is checked or not. I figure I could use a for loop but I don't know what to specify to see if the field is a check box then check it's value. I have been checking the documentation but haven't found anything to give me a clue on what to try.

I found a script sample that disables all form fields but I want to address checkbox fields in particular.

Will anyone give me some leads on what to look for in the documentation or anything to help me?

StevenD

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The Layout model provides a function for getting form elements.

xfa.layout.pageContent();

All you need to do is to apply this function to all the pages and loop through the return results.

The field type is in the child object. it's the first (and usually only node in this subobject). The code needs to look at the class name for this first node.For example:
oFld = <the field object>if(oFld.ui.nodes.item(0).className == "checkButton"){// We're in business}

Gee, wouldn't it be nice if there was a "type" property?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

StevenD
Registered: Oct 6 2006
Posts: 368
Thanks Thom.

I didn't know that a checkbox is refered to as a checkButton and didn't quite know where to go looking in the documentation.

StevenD