简体   繁体   中英

How to automatically check a specific radio button of a group in a PDF?

I'm trying to put together a Javascript or an FDF file for a PDF that selects some specific radio buttons when it's executed. For example, a patient selects how well they can sit down while working, from 0-100%. There are five mutually exclusive radio buttons for that form: Never, 1-10%, 11-33%, 34-66%, and 67-100%.

What's confusing me is that all of these buttons have to be named the same value ("Sit") in order for them to be mutually exclusive. How would I specify, whether through a Javascript or FDF file, which radio button to check if they're all named the same? Is there some other sort of identifier for these?

Thanks in advance for all your help!

The buttons have to be named the same is the first part, and it is correct. The second part is that the return value (the value you enter in the Options tab of the properties dialog) must be different.

Now, looking at the group of radio buttons (in your example, "Sit"), you have a set of (different) values. And through these values, you can programmatically set the button to be checked.

Not knowing your values, let's assume, that the return values shall be 0, 1, 2, 3, 4. To check, for example the fourth option, you would use

this.getField("Sit").value = 3 ;

and so on.

To uncheck all options, as to reset the answer, you would use

this.getField("Sit").value = "Off" ;

And that should do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM