Show a paneloverlay when ever a checkbox is checked

Go To StackoverFlow.com

0

Basically What it says in the title. The problem is right now it shows on change regardless if it was checked or unchecked.

                    <h:selectBooleanCheckbox id="checkbox" value="checkbox" >
                    </h:selectBooleanCheckbox>

                    <p:overlayPanel for="checkbox" widgetVar="descOverlay">
                        Test
                    </p:overlayPanel>
2012-04-05 22:25
by Landister


1

Try this...

<h:selectBooleanCheckbox id="chkbox" value="checkbox" ></h:selectBooleanCheckbox>

<p:overlayPanel for="chkbox" widgetVar="desc" showEvent="mousedown" hideEvent="mousedown">
           Test
</p:overlayPanel>

Revised:

<h:selectBooleanCheckbox id="checkbox" onclick="(this.checked ? descOverlay.show() : descOverlay.hide());"/>
<p:overlayPanel for="checkbox" widgetVar="descOverlay" id="descOverlay" showEvent="mouseup" hideEvent="mouseup" appendToBody="true">
    Test
</p:overlayPanel>
2012-04-06 04:53
by rags
The problem with this is if I close the overlay panel when the box is checked it will show when the box is unchecked.. - Landister 2012-04-09 13:29
check the revised answe - rags 2012-04-10 11:35
Ads