Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

On selectonemenu change uncheck checkbox - JSF/RichFaces

67 views
Skip to first unread message

Danjojo

unread,
Sep 7, 2010, 9:19:32 AM9/7/10
to
I have to uncheck a selectBooleanCheckbox lower down in the form IF it
is checked.

So I added the showOnWebAjx id to the reRender shown below.

<h:selectOneMenu id="estatus" value="#{itemHome.instance.estatus}"
required="true">
<f:selectItems id="estatuses"
value="#{mconsoleContext.ecometryItemStatusCodes}" />
<a:support event="onchange"
reRender="showOnWebAjx, ecycleWeeksAjx, orderSizeFoodPoAjx,
upcAjx, kitAjx, preOrderAjx, priorityProcessingAjx"

actionListener="#{itemHome.resetPreOrderAndPriorityProcessingFlag}"
ajaxSingle="true" />
</h:selectOneMenu>


I don't know how to uncheck the box but with the below code I can tell
when it is C1 or H1 (2 of the values where we want to uncheck the box,
the rest of the time we do nothing)

<s:decorate id="showOnWebFlagDecoration"
template="/layout/edit.xhtml">
<ui:define name="label">#{messages.showOnWebFlag}</ui:define>

<a:outputPanel id="showOnWebAjx">

<c:if test="#{'C1' eq itemHome.instance.estatus || 'H1' eq
itemHome.instance.estatus}">UNCHECK showOnWebFlag!!</c:if>

<h:selectBooleanCheckbox id="showOnWebFlag"
value="#{itemHome.instance.showOnWebFlag}"/>

</a:outputPanel>

</s:decorate>

The a:outputPanel and c:if test are my additions.

What is the proper / correct way to uncheck that box using JSF and/or
RichFaces?

Lew

unread,
Sep 7, 2010, 10:26:46 AM9/7/10
to

Set the corresponding backing bean property to 'false'.

--
Lew

Danjojo

unread,
Sep 7, 2010, 10:56:04 AM9/7/10
to

Like this?

public void resetShowOnWebFlag(ActionEvent ae){
String status = getInstance().getEstatus();
if ("C1".equals(status) || "H1".equals(status)) {
getInstance().setShowOnWebFlag(false);
}
}

0 new messages