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

setting radio button group programatically

sloopy
Registered: May 3 2010
Posts: 9

i am trying to set a radio button for a selection based on previous user input, and if they select a disclaimer clause then allow them to change their selections... here is the code:

1 /* make sure Toews Model is appropriate for selection */
2 var radeoBottun = this.getField("H_Strategist_Toews");
3 var totalScore = this.getField("SC_TotalScore");
4 var useRecommendedModel = this.getField("D_Toews_Model");
5 var general = "6"
6
7 if ( this.getField("H_Toews_Strategist").isBoxChecked(0) == 1 ) {
8 if ( totalScore.value > 109 ) {
9 app.alert("1 for testing we got here...");
10 if ( radeoBottun.value >= 1 ) {
11 app.alert("2 for testing we got here...");
12 if ( ( radeoBottun.value != 6 ) && ( useRecommendedModel.value != 2 ) ) {
13 app.alert("3 for testing we got here...");
14 if ( radeoBottun.value != "") {
15 this.getField("H_Strategist_Toews").value = "Off";
16 }
17 app.alert("In order to select a model inconsistant with the recomended model you
18 MUST select paragraph 2 on page 5, which states you do NOT want to use the recommended
19 investment model determined for your situation.");
20 }
21 }
22 }
23 }

now on line 15 i am getting a 'InvalidSetError: Set not possible, invalid or unknown.' i have also tried setting it with 6, 5, 4, 1, 0, etc (there are 6 radio buttons in the group). i dont know what i could be doing wrong here, any ideas?

thanks,
sloopy.

My Product Information:
Acrobat Standard 9.3.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You need to pass an empty string to the value property if you want no radio button to be checked.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

sloopy
Registered: May 3 2010
Posts: 9
thank you for the reply, but yes i have tried an empty string for the assignment... i.e:

15 this.getField("H_Strategist_Toews").value = "";

still comes up with the same error, the idea is when it does the tests and gets to line 15 in the above code i want it to only allow the H_Strategist_Toews radio buttons to be 6 unless the D_Toews_Model radio button is set for allowing a non recommended selection. but i cant seem to select, or even clear this field...

altho the following link would state that this is doable...
http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=23720

thanks,
sloopy.
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Exactly in which field and event of that field is this code located at?

If it is the "H_Strategist_Toews" field you can not reference that field using the "getField()" method, you need to use the "event" object's value.

George Kaiser

sloopy
Registered: May 3 2010
Posts: 9
The H_Toews_Strategist field is a checkbox widget, there are 6 strategists, each can be selected via checkbox widget, and there are 3-6 models with each strategist (the H_Stategist_Toews radio buttons select model with the Toews strategist) and the idea here is you select which strategist(s) you want, and then the model with the strategist. Depending on earlier questions to determine a recomended model for a given client, you can go with that recommendation or select a clause earlier (D_Toews_Model ) that would allow the client to select an unrecommended investment model...

Now each strategist you select you can assign a percentage of your total investment with that strategist, and those percentages with all selected strategist must add up to 100%, and in that numeric field is where this is all summed up is where the code is.

now the referenced thread on this forum would indicate that a radio button group can be set via using the name of the group and setting its value, but that doesnt seem to work, or maybe i am missing something.

thanks,
sloopy.
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
What is the field where this script is located, just the field name?

In what event in that field is the code placed?

You might want to post a sample file of what you have.

George Kaiser

sloopy
Registered: May 3 2010
Posts: 9
Here is a sample of the document. The selections are already selected to get to this point, on page 7 you will see the portfolio & strategist selection area, the allocation percentage total is where the calculation is done.The radio buttons in the Model area are the problem, you will see on page 5 there is a clause where they have to select whether they want the recommended model, and if the client does not select the second paragraph, then the only model they can select would be the recommended model.

What i am trying to do, is make it so that it will automatically select the recommended model if they dont have the clause on page page 5 selected and come up with an alert box to notify the client if they want to select an unrecommended model they have to change the clause.

Any help would be appreciated, many thanks,
sloopy.

edit:
i guess the link might help...
http://home.comcast.net/~sloopym/toews/devTest050510.pdf
sloopy
Registered: May 3 2010
Posts: 9
hmmm anyone? theorys? SWAG's?

sloopy.