Expand my Community achievements bar.

SOLVED

Subform is getting hidden on click of check & Send HCM Processes SAP

Avatar

Level 1

Hi,

I am posting this here because it is more of the Adobe form issue.

Here is my requirement, I have been struggling with.

I have 3 subforms of the same type(contains 8 fields each) to add family members. Subform 1 is mandatory and always visible. Subform 2 and 3 are hidden when the form loads. I have a javascript on the initialize event to hide them.

this.resolveNode("subform name").presence = "hidden";

When the user decides to add more details, clicks on the ADD button which makes the subform 2 and 3 visible, one at a time. Script under the click event of add button is:

if (this.resolveNode("subform2").presence == "hidden"){

this.resolveNode("subform2").presence = "visible";

this.resolveNode("PRI_DES2.PRI_FLAG2").rawValue = "X";      "I am also adding a flag on a field on the ADD button.

}

On the subform2 form ready event: I have the below code to have the subform2 visible.

if ( $record.PRI_FLAG2 == "X" ) then

       $.presence = "visible"

endif

Everything works fine till this point.

When the user fills the data and clicks on check & Send, the subform2 disappears; Note that the values in the fields are still there, I can see it when I click on the ADD button. I am sure the initialize event is triggering again on check & send, taking the form to the initial stage.

I tried various ways to restrict it. I am not using instance manager, just making subforms hidden / visible. I have both FORMCALC and Javascript on the form.

Please help with any suggestions / ask me for more details.

Thanks so much - Raj

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi Raj,

I'm not sure if I understand you right..

  1. Subform 2 and 3 don't need a script in the initialize - Go to Object | Subform | Presence | Hidden (Exclude..)
  2. If the user click the add-Button you don't need the If-Condition
  3. I would write
    1. this.resolveNode("subform2").presence = "visible";  // OR xfa.resolveNode("subform2").presence = "visible"; OR subform2.presence = "visible";
    2. this.resolveNode("PRI_DES2.PRI_FLAG2").rawValue = "X";   //OR xfa.resolveNode("PRI_DES2.PRI_FLAG2").rawValue = "X"; OR PRI_DES2.PRI_FLAG2.rawValue = "X";
  4. The last script I would not write in the form ready Event. Why you use this event?
  5. If you make the subform 2 an 3 hidden, you have to reset the entries in my opinion. You can use the following script: xfa.host.resetData("xfa.form.fomr1.subform2");

Sorry my english isn't the best. I hope I could help a little bit,

Mandy

View solution in original post

10 Replies

Avatar

Correct answer by
Level 5

Hi Raj,

I'm not sure if I understand you right..

  1. Subform 2 and 3 don't need a script in the initialize - Go to Object | Subform | Presence | Hidden (Exclude..)
  2. If the user click the add-Button you don't need the If-Condition
  3. I would write
    1. this.resolveNode("subform2").presence = "visible";  // OR xfa.resolveNode("subform2").presence = "visible"; OR subform2.presence = "visible";
    2. this.resolveNode("PRI_DES2.PRI_FLAG2").rawValue = "X";   //OR xfa.resolveNode("PRI_DES2.PRI_FLAG2").rawValue = "X"; OR PRI_DES2.PRI_FLAG2.rawValue = "X";
  4. The last script I would not write in the form ready Event. Why you use this event?
  5. If you make the subform 2 an 3 hidden, you have to reset the entries in my opinion. You can use the following script: xfa.host.resetData("xfa.form.fomr1.subform2");

Sorry my english isn't the best. I hope I could help a little bit,

Mandy

Avatar

Level 1

Thanks so much for your reply Mandy.

I tried to set the object property of the subform as Hidden. But on check, the subform goes back to HIDDEN status even theough the user wants to use it(clicking ADD button) and there is data filled in.

The last script I would not write in the form ready Event. Why you use this event?

Which last script are you talking about. If not ready event, where should we write.

I am resetting the subform fields when the user clicks on the REMOVE. I forgot to mention, there is a remove button on each subform.

thanks,

Raj

Avatar

Level 1

Can anyone check if this syntax is correct. I am using this on ADD button to make subforms visible: First subform is always visible and from 2 to 6 it has to be visible when the user clicks ADD button.

if (this.resolveNode("PRI_DES2").presence == "hidden"){

this.resolveNode("PRI_DES2").presence = "visible";

this.resolveNode("PRI_DES2.PRI_FLAG2").rawValue = "X";

}

else if (this.resolveNode("Pri_Des3").presence == "hidden")

{

this.resolveNode("Pri_Des3").presence = "visible";

this.resolveNode("PRI_DES3.PRI_FLAG3").rawValue = "X";

}

else if (this.resolveNode("Pri_Des4").presence == "hidden"){

this.resolveNode("Pri_Des4").presence = "visible";

this.resolveNode("PRI_DES4.PRI_FLAG4").rawValue = "X";

}

else if (this.resolveNode("Pri_Des5").presence == "hidden"){

this.resolveNode("Pri_Des5").presence = "visible";

this.resolveNode("PRI_DES5.PRI_FLAG5").rawValue = "X";

}

else if (this.resolveNode("Pri_Des6").presence == "hidden"){

this.resolveNode("Pri_Des6").presence = "visible";

this.resolveNode("PRI_DES6.PRI_FLAG6").rawValue = "X";

}

Thanks,

Raj

Avatar

Level 5

If it possible that you post your pdf? I think this is more easier to help.

Avatar

Level 5

Normaly it ends with else not else if.

if (condition 1)

{

     list of expression;

}else if (condition 2)

{

     list of expressions;

}else

     list of expression;

}

At the moment I can't see that anything is wrong.

But it should be possible that the path and the objectname are isn't correct.

It should be possible that the error is by another place in your pdf.

Do you use the Java Debugger? Any messages there?

Avatar

Level 5

At the moment I have seen that you use PRI_DES6 and Pri_Des6.

The system is case-sensitiv you know??

You use the right notation?

Avatar

Level 1

Hi Mandy,

Thanks for your time.

Can you please test mail me at gvsrajesh.sap@gmail.com, so that I can email you the PDF. I cannot post it for various reasons.

Thanks,

Rajesh

Avatar

Level 1

Yes Mandy,

I was trying to work one subform first which is PRI_DES2.

-Raj

Avatar

Level 1

Mandy, How do I post the PDF. Sorry, very new to this forum.