cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding and unhiding subforms

jack_boers
Explorer
0 Kudos

I have a requirement for multiple instances of subforms on an Interactive Form. The number of instances required is variable. The subform is bound to an ABAP WebDynpro context.

At run-time I create 10 elements in WebDynpro. These are mapped to the subforms so I then get 10 instances of the subforms in my form. I then hide 9 subforms.

Now I have a problem. I want the user to be able to click a button that will cause the next, currently hidden, subform to appear. I also need to have a button to hide the current subform.

There is a flowed subform called "ObjectID". It contains a positioned subform called "Objects". The "Objects" subform is the one I want to be able to hide or unhide. I also need to hide and unhide buttons on the subform to ensure that only the last subform can be hidden.

My problem is that when I click on a button in the "Objects" subform, I don't know how to access the previous or next subform to the one I click the button on.

Can someone please provide me with some sample code to allow me to address the previous or next subform?

Many thanks

Jack

Accepted Solutions (0)

Answers (2)

Answers (2)

jack_boers
Explorer
0 Kudos

Hi guys,

Thank you for the answers, but I know how to hide and unhide objects.

What I need to know is how to address a particular instance of an object.

I have a subform. At runtime I create multiple instances of this subform. Each instance is called exactly the same as all other instances. I understand that there is some way of addressing a particular instance.

I am looking for the way to address these instances.

From a particular instance I need to know how to address the next instance of the object, or the previous instance of the object.

Thanks in advance

Jack

Former Member
0 Kudos

Hey Jack,

If you drag and drop mulitple copies of an element from the library and put them all in the same subform, under the hierarchy tab on the left side, you notice that all entries have the same name, but they have [0], [1], etc. after them. I believe this is that same thing that happens when you create multiple instances of, for you, a subform. So, add the [#] after the subform name, and you should be able to gain access to it.

Hope this helps...

Cheers,

Kevin

chintan_virani
Active Contributor
0 Kudos

Jack,

You can make use of presence property and hide / unhide the subforms / buttons / fields. Also another thing to note regarding subform is that you will need to specify the complete form hierarchy when hiding / unhiding it.

Lets take a sample hierarchy as follows:-

ObjectID
|------Objects1
           |------ChildSubform1
|------Objects2
|------Objects3
           |------ChildSubform2

Now to hide ChildSubform1 you will write code in click event of that button in JavaScript (and mostly in FormCalc too) as follows:-

ObjectID.Objects1.ChildSubform1.presence = "hidden"

To unhide:-

ObjectID.Objects1.ChildSubform1.presence = "open"

Chintan

Former Member
0 Kudos

Hey Jack,

I have never tried using open myself, but you can also use visible.

Cheers,

Kevin