×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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?

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

RE: How can I let my pdf print a certain word depending on field input?

Laurens,

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?

(OP)
Thanks for your advice! I tried to use it, but for some reason, I cannot get in to work (I am quite a newbie). I attached a simplified version of the form I am building in Acrobat. Could you have a look at it and see how I can get the "Bottom Field" to print certain words depending on a score.  

RE: How can I let my pdf print a certain word depending on field input?

In livecycle, click on the bottom field 'area'.  Now do the following:

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.
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close