Expand my Community achievements bar.

SOLVED

Variable show and hide

Avatar

Level 5

There are two radio button named A and B under group_1.

Also There are two radio button named C and D under group_2.

In form 4 type subform named S_1, S_2, S_3, S_4.

If click on C with A, subform only shown S_1, S_2.

If click on C with B, subform only shown S_2, S_3

Again

If click on D with A, subform only shown S_1, S_3.

If click on D with B, subform only shown S_2, S_4.

In this condition what is the code?

Please help........

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

In the click event of the radio button exclusion group.

group_1 click event in the exclusion group:

// hide all subforms

s_1.presence = "invisible";

s_2.presence = "invisible";

s_3.presence = "invisible";

s_4.presence = "invisible";

if (this.rawValue == "A" && group_2.rawValue == "C")

{

     s_1.presence = "visible";

     s_2.presence = "visible";

}

else if (this.rawValue == "B" && group_2.rawValue == "C")

{

     s_2.presence = "visible";

     s_3.presence = "visible";

}

else if (this.rawValue == "A" && group_2.rawValue == "D")

{

     s_1.presence = "visible";

     s_3.presence = "visible";

}

else if (this.rawValue == "B" && group_2.rawValue == "D")

{

     s_2.presence = "visible";

     s_4.presence = "visible";

}

group_2 click event in the exclusion group:

// hide all subforms

s_1.presence = "invisible";

s_2.presence = "invisible";

s_3.presence = "invisible";

s_4.presence = "invisible";

if (group_1.rawValue == "A" && this.rawValue == "C")

{

     s_1.presence = "visible";

     s_2.presence = "visible";

}

else if (group_1.rawValue == "B" && this.rawValue == "C")

{

     s_2.presence = "visible";

     s_3.presence = "visible";

}

else if (group_1.rawValue == "A" && this.rawValue == "D")

{

     s_1.presence = "visible";

     s_3.presence = "visible";

}

else if (group_1.rawValue == "B" && this.rawValue == "D")

{

     s_2.presence = "visible";

     s_4.presence = "visible";

}

Now in the test, I have "A", "B", "C" and "D", however you would need to replace these with the specified values for the radio buttons (see Object > Binding).

Hope that helps,

Niall

View solution in original post

8 Replies

Avatar

Correct answer by
Level 10

Hi,

In the click event of the radio button exclusion group.

group_1 click event in the exclusion group:

// hide all subforms

s_1.presence = "invisible";

s_2.presence = "invisible";

s_3.presence = "invisible";

s_4.presence = "invisible";

if (this.rawValue == "A" && group_2.rawValue == "C")

{

     s_1.presence = "visible";

     s_2.presence = "visible";

}

else if (this.rawValue == "B" && group_2.rawValue == "C")

{

     s_2.presence = "visible";

     s_3.presence = "visible";

}

else if (this.rawValue == "A" && group_2.rawValue == "D")

{

     s_1.presence = "visible";

     s_3.presence = "visible";

}

else if (this.rawValue == "B" && group_2.rawValue == "D")

{

     s_2.presence = "visible";

     s_4.presence = "visible";

}

group_2 click event in the exclusion group:

// hide all subforms

s_1.presence = "invisible";

s_2.presence = "invisible";

s_3.presence = "invisible";

s_4.presence = "invisible";

if (group_1.rawValue == "A" && this.rawValue == "C")

{

     s_1.presence = "visible";

     s_2.presence = "visible";

}

else if (group_1.rawValue == "B" && this.rawValue == "C")

{

     s_2.presence = "visible";

     s_3.presence = "visible";

}

else if (group_1.rawValue == "A" && this.rawValue == "D")

{

     s_1.presence = "visible";

     s_3.presence = "visible";

}

else if (group_1.rawValue == "B" && this.rawValue == "D")

{

     s_2.presence = "visible";

     s_4.presence = "visible";

}

Now in the test, I have "A", "B", "C" and "D", however you would need to replace these with the specified values for the radio buttons (see Object > Binding).

Hope that helps,

Niall

Avatar

Level 5

Thanks for hep me.

I have set binding value according to radio button.

However when I click on Group_2 after click Group_1 all subforms get hidden.

What can I do?

Avatar

Level 10

Can you share the form?

When previewing the form in LC Designer or when opened in Acrobat, press Control+J to open the JavaScript Console. As you click the radio buttons do any messages appear in the console?

It probably is an object reference, like "group_1" or "Group_1".

Niall

Avatar

Level 5

Thanks.

Yes there was a problem.  Now it works well

Another problem is arisen. Before this file was flowed type conating only one group button.

Now, No flow that means all subforms are remaining same place.

So How can I get rid of?

Avatar

Level 5

here link

http://www.mediafire.com/?19r6s7l8vi6ikgr

I wish there will be no gap between two subform (flowed type)

Plaese help...

Avatar

Level 10

Hi,

Instead of "invisible", use "hidden". Both will remove the object from view, but hidden will also free up the space to allow objects underneath to move up into the free space.

The containers containing the subforms will need to be set to flowed.

Check out this examples:

Hope that helps,

Niall

Avatar

Level 5

Thanks a lot. Your files are helpful to me.

Thanks again

Avatar

Level 10

Yup, change "invisible" to "hidden" in the script: https://acrobat.com/#d=-nc0jlIjKPdgRGyEOobusg.

Good luck,

Niall