cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding Subforms via Java

Former Member
0 Kudos

Hello,

I have a form with several subforms. Its not interactive!

The subform usually look this way:

- One subform A without any bindung to a context node

-


Subform A.1 for table data

-


Subform A.2 for table data.

I made this structure because subform A contains a text, a line and other elements for which no events exists.

But I only want to show subform A and its elements if A.1 or A.2 contain data.

How can I implement this with a Java script?

As the form is non-interactive I need an appropiate event. Is this "initialization" of the subform?

My problem is the following: I dont know how I can check whether a whole table contains data. I am totally unexperienced with Java and the examples in the scripting manual just contains checks for a single field or button.

Furthermore I have a problem with understanding. If I run an event at initialization of A, A1 and A2 are not yet initialized, right? How do I recognize all the dependencies between A, A1 and A2?

Does the object "subform" even know whether it contains data at the event of initialization?

I would like to cover all that formatting in the adobe form rather than developing anything in the backend...

If you could give me a hint with a little bit of coding that would be great!

Regards,

Frank

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

Well you need the form to be Interactive in case you are planning to use JavaScript for changing layout of form.

You can use Repeating subforms and for that no JS is required. Check the following path in your LiveCycle Designer

Using LiveCycle Designer > Best Practices for Creating Adobe Form Designs > Use repeating subforms to show or hide objects > Repeating subforms

Chintan

Answers (4)

Answers (4)

OttoGold
Active Contributor
0 Kudos

Did that work for you? Is there any experience you would like to share with us to spare some time to the people looking for the same in the future? And consider closing the thread:)) Thank you, Otto

OttoGold
Active Contributor
0 Kudos

Note that your form will not work as interactive if the template is SFP based (DDIC interafce). Make sure your interface is XML BASED (!!) to avoid very common problems in WD app.

Hope we´ve helped enough:)) Regards, Otto

OttoGold
Active Contributor
0 Kudos

@Chintan: you need the form to be dynamic, not interactive;))) Otto

Former Member
0 Kudos

Hi Otto,

thanks again for your help. I think with the pseudo coding I will gonna make it.

I have understood, that some parts should better be done in the backend to have reasonable identifier to perform layout changes via java. I just hoped that i can use the methods I already have w/o adjustments.

But one question: how do i declare a form to be dynamic?

I am going to create the PDF in the backend and want to push the pdf-stream to a WD4A application (I have no context binding of form and WD4A context because of multiple choices of the form to be used, furthermore the view is quite generic and not only for one kind of form/context).

Thanks,

Frank

chintan_virani
Active Contributor
0 Kudos

Well if your read Only and enabled properties are set to false and true respectively for IntractiveFormUI element then that makes the form dynamic.

You can one more check i.e. when ALD opens go to Edit --> Form Properties --> Defaults tab --> Set Preview Type to Interactive Form and Rendering to Dynamic Form.

Chintan

OttoGold
Active Contributor
0 Kudos

Hello,

basics: Where to start with scripting:

http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_ba...

http://help.adobe.com/en_US/livecycle/es/FormCalc.pdf

Now about your questions:

1) But I only want to show subform A and its elements if A.1 or A.2 contain data.

You can place the script on different points of the form hierarchy

a) place the script on the subform A

if (A.1.rawValue != null && A.2.rawValue != null) A.presence = "visible"; else A.presence = "hidden";

b) place the script on A.1 field and A.2 field

(not the same logic like a) !!)

if (A.1.rawValue != null) A.1.parent.presence = "visible"; (placed on A.1 initialization), the same for A.2

if at least 1 or 2 (or both) is filled with data, A is definitely visible (maybe the presence = "visible" is set twice)

2) Non-interactive form

Well that is not the important thing for most of the scripting. The important thing is to have the form dynamic. This allow you to do "serious" changes to the form layout

3) if the whole table contains data

a) I didn´t find what type of scenario do you use - SFP? WD ABAP? WD Java?

If you can, you should check if the table contains data in your backend (interface initialization)

b) Maybe you can use the conditions in the context (find yourself in the manual, basically if something is not filled, it is not even added to the XML data sent to the form)

c) you can test it through number of lines, find in the JS guide above, how can you get the number of rows in the table, it is easy.

4) I would like to cover all that formatting in the adobe form rather than developing anything in the backend...

Well, it is your choice, but I would do that. If you want to know why, check my blogs about forms.

Regards, Otto