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

Radio buttons - If nested within If statements

PetafromOz
Registered: Jun 8 2009
Posts: 230

I have a development background, but I'm a total newbie at FormCalc and JavaScript. I've created a form that is successfully doing all the calcs I want including If statements, etc. But I'm stuck on one stupid thing.

Basically depending on which of 2 radio buttons are selected, I want a given calc to apply.

I have a field that calculates a total based on ranges of nos. eg. If between 1-10 is entered in Field A, then Field B = 2, if between 11-49 is entered in Field A, then Field B = 4, between 50-149 in Field A, Field B = 6, etc etc. That should be based on RadioButton A being selected - but the Field B calcs should be different if Radio Button B is selected.

My Field A & B calcs are working fine, but I can't get the statement that will trigger which of those calcs to apply depending on the radio button selection.

Can you please assist?
If I've confused you I can provide my example.

Thanks, Peta

from way... underground at Parkes - central West NSW - Australia

My Product Information:
LiveCycle Designer, Windows
PetafromOz
Registered: Jun 8 2009
Posts: 230
I made it work but my code is verrrry clumsy and I know there must be a better way. If you believe the ends justify the means, then this works and I could stop there, but I'd appreciate improvement suggestions. I used FormCalc and this is how I did it:

----- form1.firstPage.D::calculate: - (FormCalc, client) -------------------------------------------

if ( RegStdBtns.RegStd.isNull == "true" ) then

if( EFT < 11 ) then D = 2
elseif
( EFT > 10 and EFT < 126 ) then D = 4
elseif
( EFT > 125 and EFT < 251 ) then D = 6
elseif
( EFT > 250 ) then D = 8Endif
ELSE

if( EFT < 11 ) then D = 2
elseif
( EFT > 10 and EFT < 126 ) then D = 3
elseif
( EFT > 125 and EFT < 251 ) then D = 4
elseif
( EFT > 250 ) then D = 5
Endif
Endif

I would imagine I should be using maybe a While/Do type statement instead? Or maybe there's a much neater way I can box up those nested If statements? Or... something COMPLETELY different. I've been using FormCalc so far but would appreciate if possible knowing both ways (JavaScript too) to do this.

Thanks, Peta

from way... underground at Parkes - central West NSW - Australia