Expand my Community achievements bar.

Subform functionality

Avatar

Level 2

One of the questions in my form requires a Yes or No answer (Radio Buttons), if they click Yes the user is asked to fill out additional information (Name, Address, etc.) which I have in a Subform.  They have asked me if it is possible to have the Subform visible only if they use the Yes button.

FYI, I am not a programmer and have no idea how to write "language" to make this happen (if that is what the answer is). :-)  The version I work in is LiveCycle Designer ES 8.2.

I am very new to this application, have had no formal training so just kind of winging my way through - any help is greatly appreciated!

9 Replies

Avatar

Former Community Member

Yes it is possible and yes it will require script. Do you want to do modify the form yourself or are do you want a sample that you can follow?

Paul

Avatar

Level 10

Hi,

It is possible, but will require a little script.

LC Designer ES2 does have an Action Builder under the Tools menu, but I can't remember if it was in LV Designer v8.2. Action Builder would make it a little easier to get this working, as you would set out what you want in plain English and LC Designer would build the script for you.

Okay, first there is an example here that shows how to access and change the ".presence" property. This is what you need to work with when make something visible/invisible.

http://assure.ly/h7whb8

There are a couple of options:

  1. You can set the subform's presence to "visible" - does what it says on the tin - the user can see the subform.
  2. You can set it to "invisible" - here the user can't see the subform, but it still takes up space on the form (this is important if the container is set to Flowed).
  3. You can also set it to "hidden". This is like invisible, as the user can't see the subform. But in addition the subform does not take up space and the rest of the object beneath can move up to take its place (in a Flowed layout).

For the time being don't worry about Positioned (default) or Flowed layouts.

For most objects on a form, you can write script against a number of different events. For example, click, enter, exit, etc. IF you open the Script Editor and make it a few lines long (drag the bottom bar), you will see that you can select an event from the dropdown at the top and also select a language. The example and the script below are JavaScript and in the click event.

LC Designer workspace.png

Let us say that the subform is called "yourDetails" and that the radio buttons have specified values "Yes" = 1 and "No" = 0 (select the radio buttons and go to the Object > Binding palette).

Now the following script in the click event:

// this is a test to see what the value of the radio button is

if (this.rawValue == 1)

{

     // if the radio button is 1 (eg Yes) then show the subform

     yourDetails.presence = "visible";

}

else

{

     // there is no need to test here. if the radio button is not Yes it must be No, therefore hide the subform

     yourDetails.presence = "invisible";

}

Hopefully this will get you out of the traps,

Niall

Avatar

Level 2

This is great information, but I have a couple of questions.  The script that you included in your message, is that something I can copy and paste "as is' into the Script Editor?  Should I be on the Radio Buttons or the Subform when I do this?

form question.png

Thanks so much!

Avatar

Level 10

Hi,

I am a little concerned when I see the root node is "TopmostSubform"...

Did you import the form from Word or an existing PDF?

For dynamic behaviour like show/hiding objects and such you need to save the form as a Dynamic XML Form in the save-as dialog:

LC SaveAs Dialog.png

If you CAN save as a Dynamic XML Form then fine. If not (eg if the option is greyed out) then you will not be able to get dynamic behaviour to work.

On the basis that you can save the form as dynamic, the script goes in the click event of the radio button exclusion group. In your screen shot you have selected the exclusion group (which includes both radio buttons), you just need to select the click event from the Show dropdown.

Now in relation to the script it is basically good to go. You just need to change "yourDetails" to the name of the subform. I can't see that in the screenshot, but you will be able to see this in the hierarchy view.

One last word of caution. Be careful when copying and pasting script. It is worthwhile spending a little time to try and get to understand what is going on. Becuase I don't know the structure of your form, a cut and paste is rarely going to work straight off.

Hope that helps,

Niall

Avatar

Level 2

I did. The subform was added once I was in LifeCycle but the original form text came from Word. I will spend some time reviewing your notes and tread carefully - thank you for all your guidance.

Avatar

Level 2

Thank you, thank you, thank you!! It took me a couple of tries reading through your notes but I was successful in making this work. I do not have Action Builder, but I am able to save as dynamic xml and once I pasted the script in the right place it did exactly what I wanted it to do.

Thanks again.

Regards,

Kathie Blauch

Asst to Stephen Beckman

Fidelity Stock Plan Services

400 Puritan Way, MZ: M2D

Marlborough MA 01752

508.357-0226

617.276.6080(cell)

508.263.3721(fax)

kathie.blauch@fmr.com

Notice: All email sent to or from Fidelity Investments is subject to retention, monitoring and/or review by Fidelity personnel.

Please note that Fidelity is unable to accept orders left over voicemail or email regarding any account.

The information in this e-mail and in any attachments is intended solely for the attention and use of the named addressee(s) and may contain information that is considered privileged, proprietary, confidential, and/or exempt from disclosure under applicable law. If you are not the intended recipient of this email or if you have otherwise received this email in error, please immediately notify me by replying to this message or by telephone (you may call me collect). Any use, dissemination, distribution or copying of this e-mail is strictly prohibited without authorization from Fidelity Investments.

Brokerage services provided by Fidelity Brokerage Services LLC, Member NYSE, SIPC

Avatar

Level 2

Niall, I was able to get the script in and make it work with the radio button but have run into a new issue. When I test the form and select Yes, fill out the subform, and then send the filled out form to the intended receiver the completed subform does not appear. What now?

Avatar

Level 10

Hi,

If you go to the File > Form Properties > Defaults tab and set the "preserve script changes" to Automatic.

Preserve script changes.png

This will save the script changes to the subform's presence. When the form is then re-opened the subform's presence should be preserved.

Hope that helps,

Niall