Skip to main content
October 4, 2016
Question

Help - Conditional Show/Hide - or - Better Yet - Conditional Calculation based on Drop-down Selection

  • October 4, 2016
  • 3 replies
  • 606 views

I am trying to figure out how to toggle a field called "Airfare" as hidden or shown, depending on the text entered in another field called "Trip". The value of the "Trip" field is determined by a selection made in a drop-down field called "Visit". If the value of "Trip" is blank, I need "Airfare" hidden - that field is a calculated field based on data entered elsewhere. Better yet, would be for the "Airfare" field to only calculate if the value of "Trip" is not blank and if "Trip" is blank - don't calculate. Also, if the person changes the entry in "Trip" I need the hide/show to toggle back and forth between show or hidden depending on the entry. Or in the case of somebody being able to offer the conditional formula code I would need it to be able to switch back and forth between calculate and don't calculate - again based on  "Trip" field entry in case the person changes the "Trip" field. In other words, people often change their minds and I need the "Airfare" field to account for those changes and function properly or calculate properly. I'm somewhat of a novice in Javascript language - I know just enough to be somewhat dangerous. So anyone who has a solution for me, I will need other details such as where to put the script - does it go in custom calculation, validation, custom keystroke or elsewhere? Also which one of the three fields does it belong in - the "Visit" drop-down field, the "Trip" field or the "Airfare Field". Hope this makes sense. Any assistance would be appreciated. Thanks.

This topic has been closed for replies.

3 replies

Known Participant
October 19, 2016

First, you need to add all the fields you are going to need to the form. Then, you need to add some JavaScript to the fields. To add JavaScript, you do the following:

  1. Right-click the form field.
    The Properties dialog box appears.
  2. Click the Actions tab.
  3. In the Select Trigger drop-down box, select the item that you want to use to trigger the JavaScript to execute (for example, select Mouse Down for the JavaScript to execute when you press the mouse button).
  4. In the Select Action drop-down box, click Run a JavaScript.
  5. In the Actions box, type out your script.
    There are a variety of places to find help with scripts. For example:
    -- https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwjggPXem-fPAhUF2D4KHXBZAk0QFggcMAA&url=https%3…
    -- JavaScript for Acrobat | Adobe Developer Connection
  6. Click Close.
Known Participant
October 6, 2016

Can you give us information on your environment? Are you using the Forms tool in Acrobat? If so, which Acrobat version? Are you using LiveCycle Designer? If so, which version of that applications?

October 14, 2016

I am using Forms tool in Acrobat XI Pro - I am not using LiveCycle Designer.