cancel
Showing results for 
Search instead for 
Did you mean: 

Need to hide a subform in masterpage

Former Member
0 Kudos

Hi,

I'm new to adobe forms and request you to help me to fix the below issue.

I have a subform in masterpage.And the subform has three fields.In any case, either all the three values will be filled or not filled.

Can anyone help me , how to hide the subform when all the three fields in the subform are empty.

Thanks ..

Swathi

Accepted Solutions (0)

Answers (5)

Answers (5)

preethi_ande
Participant
0 Kudos

Hi Swathi,

You can use this code

if(Main.DynamicSubForm.TextField1.rawValue == null && Main.DynamicSubForm.TextField2.rawValue == null && Main.DynamicSubForm.TextField3.rawValue == null)

{

Main.DynamicSubForm.presence = "hidden";

}

Add this code at initialize event of Main Subform.

-----

Preethi

Former Member
0 Kudos

Hi Swat,

By "choice subform sets" you do not have to make any scripting.

You have a variable which decides which subform you show.

Make subform. (SF0")

Then make another in this SF0. Call it SF_CHOICE_1.

-SF0

   - SF_CHOICE_1

After this click on SF_CHOICE_1 on the tree, and there will be something like "choice subform". (I am sorry, but I am using Adobe Form Designer not in English)

Then you will see this:

-SF0

  - (unnamed - "choice subform")

     -SF_CHOICE_1

Now you can put your fields in SF_CHOICE_1.

The unnamed object should be named, and thid is the place where you can make the setting for calling (printing/showing) the subform with the data....

I think the best way to understand this, is to read a step by step tutorial (pictures included).

Best Regards,

Gábor Vaspöri

Former Member
0 Kudos

Hi Swat,

You can hide the subform by writing javascript code.

Mpage.Page1.Subform1.presence = "hidden";

In the above script Mpage is the name of master page. You write this code in docReady event.

I hope it will work.

Regards,

Amit

Florian
Active Contributor
0 Kudos

Hi Swat,

I just want to add, that it will be more effective and better to understand to check the values in the driver program and set a variable there, which is given to the interface.

All programmers of forms should keep the form itself as dumb as possible.

And this is a possible case.

Regards

Florian

Former Member
0 Kudos

Hi Florian,

What do you think about choice subform sets?

Which technology is better in this case?

Using the dummy to choose from the subforms, or make subform disappear with scripting.


Dear Swathi

There is another way to make your subform disappear.

You can use the dummy variable to decide from two subforms what you want to show.

You can make one with the data fields you want to show, and another which is empty.

This technique is called: choice subform sets

Best regards,

Gábor Vaspöri

Former Member
0 Kudos

Could you please give me the script that I can go with choice subform sets and the event in which I need to write this.Thanks in advance

Florian
Active Contributor
0 Kudos

Hi Gabor,

I think a subform set would be the good choice, because it is very easy to understand, when working trough the tree.

In this special case I would publish a Table and in the table I would do subforms, so it is very clear, what is printed and when.

Using the dummy has it charme out of it, because it is also very good to get into it. My problem is, that this might be not the last change, which is made with the form. And I hate programs, where variables sound like dummy1 dummy2 dummy3...

That why I would throw it in a structure and pass that one to the interface.

Coding in the form I wouldn't script that much, because it is very hard to understand for developers, which doesn't made the first throw.

But yes, I know, there are a few things, which have the best solutions in scripting it.

Enough talked about things around, we should go back to Swat and help him out, if he needs help anymore.

Regards

Florian

Former Member
0 Kudos

Hi,

Create a global variable at adobe interface.

At initialization check the three fields.

If they are empty set dummy to 'X'.

At adobe form context load the dummy.

Make formcalc script at the subform ready layout event.

if ($.dummy.isNull)

then $.presence = "hidden"

xfa.layout.relayout()

endif

Best regards,

Gábor Vaspöri

Former Member
0 Kudos

Thanks for the answer Gabor Vaspori.

Still I'm not able to hide the subform eventhough I wrote the above code in the event layout ready of the subform.

My doubt is , is it possible to hide a subform dynamically which is present in master page?

Please clarify.