Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Hiding Objects based on drop down selection

Avatar

Level 1

Hey guys,

     I'm hoping someone here can help me. I've been browsing forums and tried multiple options, but can't get anything to work.

This is what I have set up:

  • Drop Down list with the following options:
    • All (value 1)
    • Specific (value 2)
    • Range (value 3)
  • Two different text boxes (one named Range and the other named Specific)

What I'm trying to accomplish:

Based on the drop down selection, the boxes should either be visible or hidden:

  • All (value 1) ; both boxes are hidden
  • Specific (value 2) ; the Specific box is visible, but the Range box is hidden
  • Range (value 3) ; the Range box is visible, but the Specific box is hidden

No matter what I try (both JavaScript and FormCalc) I can't get this to work. If I start with the text boxes hidden they won't appear visible, and when they start visible they won't hide. I'm pulling my hair out on this one. Any help would be greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 10

The error is not within your code, it is within the form itself...

Within LiveCycle Designer, you have form properties which will design the PDF on how it will react

You form is set to be a Static PDF and a lot of functionalities are disabled within Static PDFs


To change your form from static to dynamic, follow the instructions:

Hope this will help ya!

View solution in original post

6 Replies

Avatar

Level 10

Hi there,

can you show with an image your hierarchy and your code?

Avatar

Level 1

The current code I'm trying to get to work (I've tried multiple):

InternalHosts is the drop down. Box, Specific, and Range are the three items I'm trying to hide depending on the selection

Capture2.PNG

Avatar

Level 10

It should be working fine by looking at this quickly... I don't see anything that wouldn't make it work...

Try using the try catch statement to see if any error occurs,

Otherwise use a message box to see what xfa.even.newText is returning as a value

If none of these work, would you share your form so I can take a look at it?

Avatar

Level 1

I've been using other code and just editing where I know to edit. I'm not sure how to do the catch statement or the return value check.

Attached is my form. I had to edit the information out for the most part because of the sensitivity of the document.

http://s000.tinyupload.com/?file_id=00155514796826374746

**Sorry for the tiny upload link. I couldn't see how to attach a document here.

Avatar

Correct answer by
Level 10

The error is not within your code, it is within the form itself...

Within LiveCycle Designer, you have form properties which will design the PDF on how it will react

You form is set to be a Static PDF and a lot of functionalities are disabled within Static PDFs


To change your form from static to dynamic, follow the instructions:

Hope this will help ya!

Avatar

Level 1

Edit:

This worked. I had an issue with my code that I fixed. Once I fixed that it worked perfectly. Thank you so much for your help.