Re: On selectonemenu change uncheck checkbox - JSF/RichFaces

Discussion in 'Java' started by Lew, Sep 7, 2010.

  1. Lew

    Lew Guest

    On Sep 7, 9:19 am, Danjojo <> wrote:
    > 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:eek:utputPanel 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:eek:utputPanel>
    >
    > </s:decorate>
    >
    > The a:eek:utputPanel and c:if test are my additions.
    >
    > What is the proper / correct way to uncheck that box using JSF and/or
    > RichFaces?


    Set the corresponding backing bean property to 'false'.

    --
    Lew
    Lew, Sep 7, 2010
    #1
    1. Advertising

  2. Lew

    Danjojo Guest

    On Sep 7, 10:26 am, Lew <> wrote:
    > On Sep 7, 9:19 am, Danjojo <> wrote:
    >
    >
    >
    > > 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:eek:utputPanel 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:eek:utputPanel>

    >
    > > </s:decorate>

    >
    > > The a:eek:utputPanel and c:if test are my additions.

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

    >
    > Set the corresponding backing bean property to 'false'.
    >
    > --
    > Lew


    Like this?

    public void resetShowOnWebFlag(ActionEvent ae){
    String status = getInstance().getEstatus();
    if ("C1".equals(status) || "H1".equals(status)) {
    getInstance().setShowOnWebFlag(false);
    }
    }
    Danjojo, Sep 7, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2lsZWVzaA==?=
    Replies:
    4
    Views:
    13,666
    =?Utf-8?B?UmVraGE=?=
    Dec 2, 2004
  2. gbattine
    Replies:
    2
    Views:
    5,126
    gbattine
    Jul 26, 2006
  3. Cijo Jose
    Replies:
    1
    Views:
    883
    jayashri
    Jun 26, 2008
  4. Coutemeier
    Replies:
    0
    Views:
    636
    Coutemeier
    May 26, 2008
  5. Hollow Quincy

    JSF 2 and Richfaces 4 - fileUpload

    Hollow Quincy, Dec 23, 2011, in forum: Java
    Replies:
    4
    Views:
    1,911
    Hollow Quincy
    Dec 27, 2011
Loading...

Share This Page