Wrong Variable getting passed

I am trying to show container on button clicks. There are 2 buttons - - Self and family and 2 containers. Both the containers contain buttons Male and Female for selection. On self button click system shows container 1.

Screenshot 1 :-

 Whereas when clicked on Family button, system shows both the containers, container 1 and 2. Up to this it is working fine.

Screenshot 2 :-

 Now, when user clicks on family button, and then clicks on Male/Female button in self container, system hides 2nd container of family. There is Nothing such written in script that when user selects male/female in self container, it should hide family container. Want a help for this kind of behavior.

Screenshot 3 :-


It looks like selecting the Male/Female in container 1 also selects the Self button. That probably causes an Ajax refresh that hides container 2.

So what does the OnChange of your Male/Female do exactly?

Hello Bhakti,

have you used JavaScript for this?

Bhakti Shinde wrote:

I am trying to show container on button clicks. There are 2 buttons - - Self and family and 2 containers. Both the containers contain buttons Male and Female for selection. On self button click system shows container 1.

Screenshot 1 :-

 Whereas when clicked on Family button, system shows both the containers, container 1 and 2. Up to this it is working fine.

Screenshot 2 :-

 Now, when user clicks on family button, and then clicks on Male/Female button in self container, system hides 2nd container of family. There is Nothing such written in script that when user selects male/female in self container, it should hide family container. Want a help for this kind of behavior.

Screenshot 3 :-


Hi,

Is it possible for you to share the oml?



Herre Bijl wrote:

It looks like selecting the Male/Female in container 1 also selects the Self button. That probably causes an Ajax refresh that hides container 2.

So what does the OnChange of your Male/Female do exactly?


Hi Herre, 

Yes it is happening that Male/Female in container 1 also selects the self button and on self button script is written as if clicks on self button, it does not show family container but only self container. 

Answering to your question, onChange of Male/Female does not hide the family container if it is already displayed. instead it only changes the background colors of both the buttons. That is if any one button is selected, its background color becomes blue with text color white and same time another button background color gets white and text color blue. Only this written on Male/Female onChange.


But the only problem is that if it selects male/female in self container when family container is displaying, that time it should not highlight the self button. It is again hitting the self button and hence, it is executing the javascript written on self button i.e. to hide the family container. Not getting why it is happening.

Priya Khade wrote:

Bhakti Shinde wrote:

I am trying to show container on button clicks. There are 2 buttons - - Self and family and 2 containers. Both the containers contain buttons Male and Female for selection. On self button click system shows container 1.

Screenshot 1 :-

 Whereas when clicked on Family button, system shows both the containers, container 1 and 2. Up to this it is working fine.

Screenshot 2 :-

 Now, when user clicks on family button, and then clicks on Male/Female button in self container, system hides 2nd container of family. There is Nothing such written in script that when user selects male/female in self container, it should hide family container. Want a help for this kind of behavior.

Screenshot 3 :-


Hi,

Is it possible for you to share the oml?




Hi Priya,


Please find the attachment.

Suhas Jamdade wrote:

Hello Bhakti,

have you used JavaScript for this?

Hi Suhas,


Yes i have used Javascript.

on self button script is written as if clicks on self button, it does not show family container but only self container. 

Onchange of Male/Female button javascript, onChange of Male/Female does not hide the family container if it is already displayed. instead it only changes the background colors of both the buttons. That is if any one button is selected, its background color becomes blue with text color white and same time another button background color gets white and text color blue.

Here, the problem is that if it selects male/female in self container when family container is displaying, that time it should not highlight the self button. It is again hitting the self button and hence, it is executing the javascript written on self button i.e. to hide the family container. Not getting why it is happening.

Bhakti Shinde wrote:

Suhas Jamdade wrote:

Hello Bhakti,

have you used JavaScript for this?

Hi Suhas,


Yes i have used Javascript.

on self button script is written as if clicks on self button, it does not show family container but only self container. 

Onchange of Male/Female button javascript, onChange of Male/Female does not hide the family container if it is already displayed. instead it only changes the background colors of both the buttons. That is if any one button is selected, its background color becomes blue with text color white and same time another button background color gets white and text color blue.


If you use javascript after that if you are used the ajax refresh then whatever you applied the javascript it removed. Instead of javascript.
Use the following steps:
1) Use the two boolean variable and default value set to false and set that boolean variable to respective containers.
2) When you click on first button, on button action set first boolean value to true and assign that boolean value to the 1st container Display and use ajax refresh and
2) When you click on second button set the both boolean values to true and use ajax refresh for both containers


Bhakti Shinde wrote:

Herre Bijl wrote:

It looks like selecting the Male/Female in container 1 also selects the Self button. That probably causes an Ajax refresh that hides container 2.

So what does the OnChange of your Male/Female do exactly?


Hi Herre, 

Yes it is happening that Male/Female in container 1 also selects the self button and on self button script is written as if clicks on self button, it does not show family container but only self container. 

Answering to your question, onChange of Male/Female does not hide the family container if it is already displayed. instead it only changes the background colors of both the buttons. That is if any one button is selected, its background color becomes blue with text color white and same time another button background color gets white and text color blue. Only this written on Male/Female onChange.

Ah, okay. So if I get it right, when someone selects the Self button it will only show Container 1. And when someone clicks the Male/Female button it also selects the Self button which then runs a script as if the Self button was clicked.

So doesn't that mean that clicking the Male/Female button in Container one also indirectly clicks the Self button which then only shows the Self container.

Why does clicking the Male/Female button need to select the Self button? If you remove that it shouldn't hide Container 2.

Herre Bijl wrote:

Bhakti Shinde wrote:

Herre Bijl wrote:

It looks like selecting the Male/Female in container 1 also selects the Self button. That probably causes an Ajax refresh that hides container 2.

So what does the OnChange of your Male/Female do exactly?


Hi Herre, 

Yes it is happening that Male/Female in container 1 also selects the self button and on self button script is written as if clicks on self button, it does not show family container but only self container. 

Answering to your question, onChange of Male/Female does not hide the family container if it is already displayed. instead it only changes the background colors of both the buttons. That is if any one button is selected, its background color becomes blue with text color white and same time another button background color gets white and text color blue. Only this written on Male/Female onChange.

Ah, okay. So if I get it right, when someone selects the Self button it will only show Container 1. And when someone clicks the Male/Female button it also selects the Self button which then runs a script as if the Self button was clicked.

So doesn't that mean that clicking the Male/Female button in Container one also indirectly clicks the Self button which then only shows the Self container.

Why does clicking the Male/Female button need to select the Self button? If you remove that it shouldn't hide Container 2.


When you click on self button you get the male/female container.
Why does clicking the Male/Female button need to select the Self button? No need to select self button.
When you click on self button just set the self boolean value True and use ajax refresh on self container.

Suhas Jamdade wrote:

Bhakti Shinde wrote:

Suhas Jamdade wrote:

Hello Bhakti,

have you used JavaScript for this?

Hi Suhas,


Yes i have used Javascript.

on self button script is written as if clicks on self button, it does not show family container but only self container. 

Onchange of Male/Female button javascript, onChange of Male/Female does not hide the family container if it is already displayed. instead it only changes the background colors of both the buttons. That is if any one button is selected, its background color becomes blue with text color white and same time another button background color gets white and text color blue.


If you use javascript after that if you are used the ajax refresh then whatever you applied the javascript it removed. Instead of javascript.
Use the following steps:
1) Use the two boolean variable and default value set to false and set that boolean variable to respective containers.
2) When you click on first button, on button action set first boolean value to true and assign that boolean value to the 1st container Display and use ajax refresh and
2) When you click on second button set the both boolean values to true and use ajax refresh for both containers


Hi Suhas,

i have not used ajax refresh after javascript


Whats the issue now?
Don't set SelfInfo and FamilyInfo container Display to false. Use the boolean variable.
In this scenario there is no need of javaScript.

If you want javaScript then use the css for both container Display:none;
and using javaScript set it to Display:block,
Set SelfInfo and FamilyInfo container Display to True.