How can I let my pdf print a certain word depending on field input?
How can I let my pdf print a certain word depending on field input?
(OP)
Dear All,
I am building a pdf form with a few pairs of radio buttons. Depending on whether people click "yes" of "no" a value of either 0 or 1 is added to a total score. This total score will appear in score field of the bottom of the document. So far, I am not experiencing any problems. What I would like to do know is the following:
If people score between 0 and 5 I'd like the word "LOW" to appear in a field. When people score between 6 and 14, the word "MEDIUM" should appear and for scores ranging between 15 and 37, the word "HIGH" should be printed. What code should I add to a field to get this done?
Please help me out here!
Thanks a million!
Laurens
I am building a pdf form with a few pairs of radio buttons. Depending on whether people click "yes" of "no" a value of either 0 or 1 is added to a total score. This total score will appear in score field of the bottom of the document. So far, I am not experiencing any problems. What I would like to do know is the following:
If people score between 0 and 5 I'd like the word "LOW" to appear in a field. When people score between 6 and 14, the word "MEDIUM" should appear and for scores ranging between 15 and 37, the word "HIGH" should be printed. What code should I add to a field to get this done?
Please help me out here!
Thanks a million!
Laurens
RE: How can I let my pdf print a certain word depending on field input?
If using livecycle designer, you should be able to do something as a calc event using FormCalc:
var total = sum (Table1.Row2.Sum + Table1.Row10.Sum)
if (total <= 0) then
"Low"
elseif (total <= 14) then
"Medium"
elseif (total <=37) then
"High"
endif
____
The Table1.Row2.Sum can also be the Binding assigned to the cells you're adding if you're not using a table. Also, make sure the cell where you're entering this formula is a text field.
RE: How can I let my pdf print a certain word depending on field input?
RE: How can I let my pdf print a certain word depending on field input?
1.) Click on Window in your file/edit bar.
2.) Click Script Editor
3.) Next to show, select "Calculate"
4.) Next to Language, select "FormCalc"
5.) Next to Run At, select "Client"
Now enter the code below:
var rb1
var rb2
var rb3
var rb4
var rb5
if (button1.rawValue==1) then
rb1 = "1"
endif
if (button2.rawValue==1) then
rb2 = "1"
endif
if (button3.rawValue==1) then
rb3 = "1"
endif
if (button4.rawValue==1) then
rb4 = "1"
endif
if (button5.rawValue==1) then
rb5 = "1"
endif
var total = sum (rb1 + rb2 + rb3 + rb4 + rb5)
if (total <= 2) then
"Low"
elseif (total <= 4) then
"Medium"
elseif (total <=5) then
"High"
endif
Rename your radio button groups into "button1" - "button5" and presto chango! Let me know if you have additional questions.
PS
There may be an easier way to do this as I have a tendency to over complicate things from time to time, but this appears to work well.