Hello to all members.
I am trying to create a report form with a LOT of radio button groups (80 groups with 6 choices each).
Some of the radio buttons will also have a script attached.
My problem is that as the number of radio buttons increases, so is the time required to rename, group and adjust the new fields in the form. So I decided to write a small script to create these radio button groups for me. The script reads information from a field already created manually and builds the required sets of radiobutton groups (or so I believe...)
The script works fine, in the sense that the new groups are created as expected in terms of name and position.
I am having issues however with the following:
- assigning the border color (can't seem to find the proper function to do that);
- assigning a separate style for each of the radio buttons in the same group (f.style=style.xx works but it applies the same style to all created buttons of the group, not to the one I want);
- assigning a custom return value to some of the radio buttons (I use f.value="some value" which is ignored and I get default values like Choice1, Choice2 etc)
- finally, setting the name of the group seems impossible (something that can be done manually, when you select all buttons within the group)
To clarify further , the individual groups (ISM.G1, ISM.G2, ISM.G3 and so on) are created by giving the same name to each radio button . While each radio button is operational within the proper group (as expected) it seems that I cannot access each radio button individually in order to alter its properties as I wish.
Because of this, after all required radiobuttons and groups are created, I go back and edit each option manually in order to get the desired results.
Any help or guidance welcome and much appreciated.
Thanks in advance,
P.S.I have attached a txt file with my code (it fires when a button is pressed) and a screenshot of how the radiobutton groups are expected to look like
Apologies for the omission...
I am using Acrobat DC Pro
Moved from Using the Community (which is about the forums) to the correct forum... Mod
To ask in the forum for your program please start at https://community.adobe.com/
Just like that the period in the field name is used to group fields together, it's also used to indicate individual "widgets" in a group. For example, to access the first widget in a group called "ISM.G2" you can use "ISM.G2.0" as the field name when calling getField. Then "ISM.G2.1" to access the second field (based on the order of creation), etc.
Note, though, that some properties are shared by all the widgets in the group. So, for example, if you set "ISM.G2.0" as read-only, it will affect the entire group. But if you set its fill color to red, it will only affect that one widget.
As always, the simplest answers are the hardest to find...
Thank you, your suggestion worked like a charm.
Unfortunately though, I seem unable to use the same arrangement to set return values (or choices) of individual radio buttons within the same group.
The code works but when I check, the values of the radio buttons are the default.
I must be doing something wrong....
Any help appreciated
Use the property exportValues for this.
If you want to set export value of radio buttons you need to use 'exportValues'.
I see you want to change 1st,3rd and 4th value, try like this:
This is correct, but you can't "skip" a value. If you use that code the export value of the second field in the group will become an empty string. It will not remain what it was before...
It doesn't "skip" but you can't set empty export value to radio button, it revert to previous value, so if you use "" it won't change that button value. Unless I'm missing something?
You're right. It actually does keep the old value...
Thank you so much! I'm just a tiny bit wiser now...