I have a series of questions on a form, each of which has five radio buttons to designate the answer, ranging from 1 (poor) to 5 (excellent). I have the export value of each button set to just the numeral, which I assume Acrobat treats as a text string, and not an actual number. What I want to do is calculate and display an average of all the values. How do I convert each radio button's text string output to an integer than can be manipulated mathematically?
For example:
In the Radio group does not have a selection then the value will be "Off". So if there is a chance that there will not be a selection the code needs to test the value before making a conversion. The code above insures a default value of zero. If the selection is garunteed to be something then the test is unnecessary.
Number conversions can also be done by forcing a numeracal context:
For example:
nExport = cExport*1;
However, I like the explict cast better.
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