users@glassfish.java.net

Re: commandButton problem

From: Franck Quinard <franck.quinard_at_gmail.com>
Date: Thu, 9 Mar 2006 07:05:09 +0100

Ryan,

I just did your test and the result is the same. The first click works, the
second doesn't.
I remember that it was working in previous version, around b29 I believe. I
working with the b39 now.

Thanks,

Franck

On 3/7/06, Ryan Lubke <Ryan.Lubke_at_sun.com> wrote:
>
> Franck Quinard wrote:
> > Hello,
> >
> > I have a problem with the behavior of the commandButton. I want it to
> > disable the comboBox when I click ones on it and I want it to enable
> > the comboBox when click on it again. The first part is working but the
> > second doesn't.
> >
> > Here is the code
> >
> > <h:selectOneMenu value="#{resumeBean.bgColor}"
> > disabled="#{!resumeBean.colorSupported}">
> > <f:selectItems value="#{resumeBean.availableColors}"/>
> > </h:selectOneMenu>
> >
> > <h:commandButton value="#{resumeBean.colorSupportLabel}"
> >
> > actionListener="#{resumeBean.toggleColorSupport}"
> > immediate="true"/>
> >
> >
> > in the bean.
> >
> > public void toggleColorSupport(ActionEvent event) {
> > isColorSupported = !isColorSupported;
> > }
> >
> >
> > public boolean isColorSupported() {
> > return (isColorSupported);
> > }
> >
> > any idea why the second click on the button doesn't get trigger the
> > listener of the selectOneMenu?Thank you
> >
> > Franck
> Franck,
>
> I've tried a similar test locally and don't see a problem.
> Here is what I have:
>
> ----------------------------------------- CommandButtonTest.jsp
> ------------------------------------
> <f:view>
> <h:form>
> <h:selectOneMenu value="#{test.color}"
> disabled="#{test.colorSupported}">
> <f:selectItem itemValue="red" itemLabel="red"/>
> <f:selectItem itemValue="green" itemLabel="green"/>
> <f:selectItem itemValue="blue" itemLabel="blue"/>
> </h:selectOneMenu>
> <h:commandButton value="Click Me"
> actionListener="#{test.toggle}"
> immediate="true"/>
> </h:form>
> </f:view>
>
> --------------------------------------------------------------------------------------------------------------
>
> ------------------------------------------------ test bean
> -------------------------------------------------
> public void toggle(ActionEvent actionEvent) throws
> AbortProcessingException{
> disabled = !disabled;
> }
>
> public String getColor() {
> return color;
> }
>
> public void setColor(String color) {
> this.color = color;
> }
>
> public boolean isColorSupported() {
> return disabled;
> }
>
> --------------------------------------------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>