Skip navigation
Motogel
Currently Being Moderated

How to hide and reveal content conditionally?

Apr 30, 2012 9:18 AM

Tags: #acrobat #javascript

Using Acrobat Pro X.

 

I have a load of text on a form that I want to obscure under certain circumstances and reveal on others.

 

I have tried using a text box and putting a script into the custom format field to switch between white and transparent fill colors, but it is not working reliably.

 

In the meantime, I have a hack with a gazillion overlapping check boxes .... but there must be a better way.  I cannot edit the underlying text for various reasons.

 

Thanks in advance for any help.

 
Replies
  • George Johnson
    11,662 posts
    Aug 11, 2002
    Currently Being Moderated
    Apr 30, 2012 9:40 AM   in reply to Motogel

    I sometimes use a button for this, the same idea as you used a text field for. When you ay this was unreliable, can you provide more details? Under what conditions do you want to show/hide the text?

     
    |
    Mark as:
  • George Johnson
    11,662 posts
    Aug 11, 2002
    Currently Being Moderated
    Apr 30, 2012 11:40 AM   in reply to Motogel

    Is it a continuous block of text that can be obscured with a single rectangular object, or is it scattered about the page or pages? Is the value a field value or a JavaScript variable?

     
    |
    Mark as:
  • George Johnson
    11,662 posts
    Aug 11, 2002
    Currently Being Moderated
    Apr 30, 2012 12:45 PM   in reply to Motogel

    You can use multiple read-only buttons that all have the same name, and can show/hide them all with a single statement by controlling their visibility:

     

    getField("cover").display = bYourVar ? display.visible : display.hidden;

     

    Where "cover" is the name of the buttons and bYourVar is a variable that is true when you want the text to be hidden and false when you want the text to be shown.

     

    You can show/hide text by placing it on a separate layer (OCG) and controlling the visibility of the layer via JavaScript, but setting this up might not be possible in this instance given your current restraints on editing.

     
    |
    Mark as:
  • George Johnson
    11,662 posts
    Aug 11, 2002
    Currently Being Moderated
    Apr 30, 2012 1:11 PM   in reply to George Johnson

    Sorry, I completely misread your reply, but fortunately the code will work with a single button as well.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 30, 2012 1:17 PM   in reply to George Johnson

    George I started a new thread if you have time if you could look at it I would greatly appreciate it.

     

    <http://forums.adobe.com/thread/996327>

     

    Best regards,

     

    chad S.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points