Expand my Community achievements bar.

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

there is really a limitation in hiding subforms ... ?!!! (sample included)

Avatar

Level 3

Hello,

I have created a simple form which should work as described below:

- by click on checkbox QUESTION 1 the subform of ANSWERS related to this question appears, by unclick it disappears

- by click on checkbox QUESTION 2 the subform of ANSWERS related to this question, question 2, appears, by unclick it disappears

simple, isn't it? well it does work with presence = visible/invisble BUT it just won't work with presence = visible/hidden.

could it be that adobe cannot handle anything that simple? I do not get any errors

by the way. the form is set up to reader 8.1 because SAP cannot handle higher versions.

anyway, I tested it in reader 9.1, too. In neither case does it work!

here you are experts, test it and please tell my I am wrong & show me the way it might work ; )

https://acrobat.com/#d=kQXJ4cCMfu6JoCBEZXliyg

(I just have updated the pdf file, after the upload at 10:20)

Code on CheckBox question 1

if (this.rawValue == "X"){

  // view SubForm sf_vp02 

  xfa.form.data.page1.sf_situation1.sf_vp02.presence = "visible";

 

  // obsolete!!!!! but ... make sure and view them one by one

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme1.presence = "visible";

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme2.presence = "visible";

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme3.presence = "visible";

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme4.presence = "visible";

  xfa.form.data.page1.sf_situation1.sf_vp02.txf_freitext4.presence  = "visible";

 

  console.println(" situation 1 everything is visible");

}

else{

  // reset CheckBox 2

  xfa.form.data.page1.sf_situation1.sf_vp01.chb_beratung1.rawValue = "-";

 

  // reset all values in SubForm sf_vp_02

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme1.rawValue = "-";

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme2.rawValue = "-";

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme3.rawValue = "-";

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme4.rawValue = "-";

  xfa.form.data.page1.sf_situation1.sf_vp02.txf_freitext4.rawValue  = "";

 

 

  // hide SubFom sf_vp02 and its children

  xfa.form.data.page1.sf_situation1.sf_vp02.presence = "hidden";

 

  // obsolete!!!!! but ... make sure and hide them one by one

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme1.presence = "hidden";

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme2.presence = "hidden";

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme3.presence = "hidden";

  xfa.form.data.page1.sf_situation1.sf_vp02.chb_massnahme4.presence = "hidden";

  xfa.form.data.page1.sf_situation1.sf_vp02.txf_freitext4.presence  = "hidden";

 

  console.println(" situation 1 everything is reseted and hidden");

}

code on checkbox QUESTION 2 :

if (this.rawValue == "X"){

  // view SubForm sf_vp02 

  xfa.form.data.page1.sf_situation2.sf_vp02.presence = "visible";

 

  // obsolete!!!!! but ... make sure and view them one by one

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme1.presence = "visible";

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme2.presence = "visible";

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme3.presence = "visible";

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme4.presence = "visible";

  xfa.form.data.page1.sf_situation2.sf_vp02.txf_freitext4.presence  = "visible";

 

  console.println(" situation 2 everything is visible");

}

else{

  // reset CheckBox 2

  xfa.form.data.page1.sf_situation2.sf_vp01.chb_beratung2.rawValue = "-";

 

  // reset all values in SubForm sf_vp_02

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme1.rawValue = "-";

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme2.rawValue = "-";

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme3.rawValue = "-";

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme4.rawValue = "-";

  xfa.form.data.page1.sf_situation2.sf_vp02.txf_freitext4.rawValue  = "";

 

 

  // hide SubFom sf_vp02 and its children

  xfa.form.data.page1.sf_situation2.sf_vp02.presence = "hidden";

 

  // obsolete!!!!! but ... make sure and hide them one by one

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme1.presence = "hidden";

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme2.presence = "hidden";

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme3.presence = "hidden";

  xfa.form.data.page1.sf_situation2.sf_vp02.chb_massnahme4.presence = "hidden";

  xfa.form.data.page1.sf_situation2.sf_vp02.txf_freitext4.presence  = "hidden";

 

  console.println(" situation 2 everything is reseted and hidden");

}

sf_hidden_screen.JPG

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi,

The problem seems to be that your subforms "sf_situation1" and "sf_situation2" are marked as positioned, if these are changed to flowed then your code works as you would expect.

I realise that this changes the layout of your form but it does allow the code to work as I would expect.

hope this helps

Malcolm

View solution in original post

4 Replies

Avatar

Level 5

Hi,

I am unable to download the document, the error says "Document does not exist". Think it may not be shared correctly.

However looking at your code I can see that you have called the top level form "data", as this is a command word that is used fairly regularly in LiveCycle forms, can you rename it to some else ( E.g. "mainForm") and see if the problem persists.

If you can check the settings on the shared document and let us know when it is available I am sure we will be able to look at the problem in more detail.

Hope this helps

Malcolm

Avatar

Level 3

Hi,

now the first PDF file should be downloadable

I have tested my form as you just suggested: replaced "data" on top level node with "Myform". it did not help

I have to use 3 levels of subforms, because there must be some special handling of the form-objects, later

here updated form.

https://acrobat.com/#d=oXru79MFuFFSxQ5nI1cPPA

Avatar

Correct answer by
Level 5

Hi,

The problem seems to be that your subforms "sf_situation1" and "sf_situation2" are marked as positioned, if these are changed to flowed then your code works as you would expect.

I realise that this changes the layout of your form but it does allow the code to work as I would expect.

hope this helps

Malcolm

Avatar

Level 3

Thank you very much Malcolm,

it really helped.

for everyone else here the updated form:

https://acrobat.com/#d=j0yNv*U2oG5hMMpPCGO9sQ