You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Alexander Wallace <aw...@rwmotloc.com> on 2007/07/17 17:40:50 UTC

multiple selectOneMenu causes commandButton not to call action on submit

Hi All!

We have weird issues with MyFaces 1.3 ... When we have multiple  
selectOneMenu in one form, the commandButton we have to act on the  
form does not stop in the action or action listener methods of the  
managed bean.

If we remove all but one selectOneMenu, the commandButton works...

Any clues?

The code is below...


This does NOT work:

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<h:panelGrid rendered="#{!accountupdate.viewOrderSummaryDetail}">
    <h:selectOneRadio id="selectedTier0" value="# 
{accountupdate.selectedTier}" layout="pageDirection"  
valueChangeListener="#{accountupdate.checkSelectedTier}"  
onclick="submit()" immediate="true">
        <f:selectItem itemValue="tier1" itemLabel="Tier 1: Account  
Free" />                      <f:selectItem itemValue="tier2"  
itemLabel="Tier 2: Account - $ cost per Year" />
        <f:selectItem itemValue="tier3" itemLabel="Tier 3: Account -  
$ cost per Year" />
    </h:selectOneRadio>    <h:panelGrid rendered="# 
{accountupdate.showBillingInformation}">
        <h:panelGrid columns="1">
            <h:outputText value="Billing Information"/>
        </h:panelGrid>              <h:panelGrid columns="2"  
cellpadding="50" cellspacing="50">                           
<h:outputText value="Address:"/>
            <h:inputText id="address" value="# 
{accountupdate.address}" required="false"/ 
 >                                  <h:outputText value="City:"/>
            <h:inputText id="city" value="#{accountupdate.city}"  
required="false"/>                           <h:outputText  
value="State: "/>
            <h:panelGroup>
                <h:selectOneMenu id="selectedState" value="# 
{accountupdate.selectedState}">
                    <f:selectItems value="# 
{accountupdate.countryUSStates}"/>
                </h:selectOneMenu>
            </h:panelGroup>
            <h:outputText value="Zip Code:"/>
            <h:inputText id="zipcode" value="# 
{accountupdate.zipCode}" required="false"/>        </h:panelGrid>
        <h:panelGrid  columns="1">
            <h:outputText value="Credit Card Details:"/>
        </h:panelGrid>
        <h:panelGrid  columns="2">
            <h:outputText value="Cardholder Name:"/>
            <h:inputText id="cardholdername" value="# 
{accountupdate.cardholderName}" required="false"/ 
 >                                 <h:outputText value="Credit Card  
Type:"/>
            <h:inputText id="creditcardtype" value="# 
{accountupdate.creditCardType}" required="false"/ 
 >                           <h:outputText value="Card Number:"/>
            <h:inputText id="cardnumber" value="# 
{accountupdate.cardNumber}" required="false"/>                      </ 
h:panelGrid>
        <h:panelGrid columns="4">
            <h:outputText value="Expiration: "/>
            <h:panelGroup>
                <h:selectOneMenu id="expirationMonth" value="# 
{accountupdate.expirationMonth}">
                    <f:selectItems value="# 
{accountupdate.selectedMonths}"/>                       </ 
h:selectOneMenu>
            </h:panelGroup>
            <h:outputText value="Year: "/>
            <h:inputText id="expirationYear" value="# 
{accountupdate.expirationYear}" required="false"/>
        </h:panelGrid>
        <h:panelGrid columns="2">
            <h:outputText value="Security Code:"/>
            <h:inputSecret redisplay="false" value="# 
{accountupdate.securityCode}" required="false"/>
        </h:panelGrid>
        <h:commandButton value="View Order Summary" actionListener="# 
{accountupdate.saveSummary}"/>
    </h:panelGrid>
    </h:panelGrid>
<h:panelGrid rendered="#{accountupdate.viewOrderSummaryDetail}">
    <h:outputText value="#{accountupdate.selectedCostDescription}"/>
    <h:outputText value="Billing Information: "/>     <h:panelGrid  
columns="2">
        <h:outputText value="Address: "/>
        <h:outputText value="#{accountupdate.address}"/>
        <h:outputText value="City: "/>
        <h:outputText value="#{accountupdate.city}"/>
        <h:outputText value="State: "/>
        <h:outputText value="#{accountupdate.nameState}"/>
        <h:outputText value="Zip Code: "/>
        <h:outputText value="#{accountupdate.zipCode}"/>
    </h:panelGrid>    <h:panelGrid columns="2">                
<h:commandButton value="Place Order" action="# 
{accountupdate.saveTierInfo}"/>
        <h:commandButton value="Back" actionListener="# 
{accountupdate.backToForm}"/>    </h:panelGrid>
</h:panelGrid>
<h:panelGrid rendered="#{!accountupdate.showBillingInformation}">
    <h:commandButton value="Save" action="# 
{accountupdate.saveTierInfo}"/>
</h:panelGrid>

And the following DOES work, the difference is that there is only one  
selectOneMenu, the other elements were made into regular inputs...

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<h:panelGrid rendered="#{!accountupdate.viewOrderSummaryDetail}">
    <h:selectOneRadio id="selectedTier0" value="# 
{accountupdate.selectedTier}" layout="pageDirection"  
valueChangeListener="#{accountupdate.checkSelectedTier}"  
onclick="submit()" immediate="true">
        <f:selectItem itemValue="tier1" itemLabel="Tier 1: Account  
Free" />                      <f:selectItem itemValue="tier2"  
itemLabel="Tier 2: Account - $ cost per Year" />
        <f:selectItem itemValue="tier3" itemLabel="Tier 3: Account -  
$ cost per Year" />
    </h:selectOneRadio>    <h:panelGrid rendered="# 
{accountupdate.showBillingInformation}">
        <h:panelGrid columns="1">
            <h:outputText value="Billing Information"/>
        </h:panelGrid>              <h:panelGrid columns="2"  
cellpadding="50" cellspacing="50">                           
<h:outputText value="Address:"/>
            <h:inputText id="address" value="# 
{accountupdate.address}" required="false"/ 
 >                                  <h:outputText value="City:"/>
            <h:inputText id="city" value="#{accountupdate.city}"  
required="false"/>                           <h:outputText  
value="State: "/>
            <h:selectOneMenu id="selectedState" value="# 
{accountupdate.selectedState}">
                <f:selectItems value="# 
{accountupdate.countryUSStates}"/>
            </h:selectOneMenu>
            <h:outputText value="Zip Code:"/>
            <h:inputText id="zipcode" value="# 
{accountupdate.zipCode}" required="false"/>        </h:panelGrid>
        <h:panelGrid  columns="1">
            <h:outputText value="Credit Card Details:"/>
        </h:panelGrid>
        <h:panelGrid  columns="2">
            <h:outputText value="Cardholder Name:"/>
            <h:inputText id="cardholdername" value="# 
{accountupdate.cardholderName}" required="false"/ 
 >                                 <h:outputText value="Credit Card  
Type:"/>
            <h:inputText id="creditcardtype" value="# 
{accountupdate.creditCardType}" required="false"/ 
 >                           <h:outputText value="Card Number:"/>
            <h:inputText id="cardnumber" value="# 
{accountupdate.cardNumber}" required="false"/>                      </ 
h:panelGrid>
        <h:panelGrid columns="5">
            <h:outputText value="Expiration: "/ 
 >                                   <h:outputText value="Month: "/>
            <h:inputText id="expirationMonth" value="# 
{accountupdate.expirationMonth}" required="false"/>
            <h:outputText value="Year: "/>
            <h:inputText id="expirationYear" value="# 
{accountupdate.expirationYear}" required="false"/>
        </h:panelGrid>
        <h:panelGrid columns="2">
            <h:outputText value="Security Code:"/>
            <h:inputSecret redisplay="false" value="# 
{accountupdate.securityCode}" required="false"/>
        </h:panelGrid>
        <h:commandButton value="View Order Summary" actionListener="# 
{accountupdate.saveSummary}"/>
    </h:panelGrid>
    </h:panelGrid>
<h:panelGrid rendered="#{accountupdate.viewOrderSummaryDetail}">
    <h:outputText value="#{accountupdate.selectedCostDescription}"/>
    <h:outputText value="Billing Information: "/>     <h:panelGrid  
columns="2">
        <h:outputText value="Address: "/>
        <h:outputText value="#{accountupdate.address}"/>
        <h:outputText value="City: "/>
        <h:outputText value="#{accountupdate.city}"/>
        <h:outputText value="State: "/>
        <h:outputText value="#{accountupdate.nameState}"/>
        <h:outputText value="Zip Code: "/>
        <h:outputText value="#{accountupdate.zipCode}"/>
    </h:panelGrid>    <h:panelGrid columns="2">                
<h:commandButton value="Place Order" action="# 
{accountupdate.saveTierInfo}"/>
        <h:commandButton value="Back" actionListener="# 
{accountupdate.backToForm}"/>    </h:panelGrid>
</h:panelGrid>
<h:panelGrid rendered="#{!accountupdate.showBillingInformation}">
    <h:commandButton value="Save" action="# 
{accountupdate.saveTierInfo}"/>
</h:panelGrid>



THANKS!



Re: multiple selectOneMenu causes commandButton not to call action on submit

Posted by Alexander Wallace <aw...@rwmotloc.com>.
Forgot to mention that I'm doing this in a portlet ...

On Jul 17, 2007, at 10:40 AM, Alexander Wallace wrote:

> Hi All!
>
> We have weird issues with MyFaces 1.3 ... When we have multiple  
> selectOneMenu in one form, the commandButton we have to act on the  
> form does not stop in the action or action listener methods of the  
> managed bean.
>
> If we remove all but one selectOneMenu, the commandButton works...
>
> Any clues?
>
> The code is below...
>
>
> This does NOT work:
>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
>
> <h:panelGrid rendered="#{!accountupdate.viewOrderSummaryDetail}">
>    <h:selectOneRadio id="selectedTier0" value="# 
> {accountupdate.selectedTier}" layout="pageDirection"  
> valueChangeListener="#{accountupdate.checkSelectedTier}"  
> onclick="submit()" immediate="true">
>        <f:selectItem itemValue="tier1" itemLabel="Tier 1: Account  
> Free" />                      <f:selectItem itemValue="tier2"  
> itemLabel="Tier 2: Account - $ cost per Year" />
>        <f:selectItem itemValue="tier3" itemLabel="Tier 3: Account -  
> $ cost per Year" />
>    </h:selectOneRadio>    <h:panelGrid rendered="# 
> {accountupdate.showBillingInformation}">
>        <h:panelGrid columns="1">
>            <h:outputText value="Billing Information"/>
>        </h:panelGrid>              <h:panelGrid columns="2"  
> cellpadding="50" cellspacing="50">                           
> <h:outputText value="Address:"/>
>            <h:inputText id="address" value="# 
> {accountupdate.address}" required="false"/ 
> >                                  <h:outputText value="City:"/>
>            <h:inputText id="city" value="#{accountupdate.city}"  
> required="false"/>                           <h:outputText  
> value="State: "/>
>            <h:panelGroup>
>                <h:selectOneMenu id="selectedState" value="# 
> {accountupdate.selectedState}">
>                    <f:selectItems value="# 
> {accountupdate.countryUSStates}"/>
>                </h:selectOneMenu>
>            </h:panelGroup>
>            <h:outputText value="Zip Code:"/>
>            <h:inputText id="zipcode" value="# 
> {accountupdate.zipCode}" required="false"/>        </h:panelGrid>
>        <h:panelGrid  columns="1">
>            <h:outputText value="Credit Card Details:"/>
>        </h:panelGrid>
>        <h:panelGrid  columns="2">
>            <h:outputText value="Cardholder Name:"/>
>            <h:inputText id="cardholdername" value="# 
> {accountupdate.cardholderName}" required="false"/ 
> >                                 <h:outputText value="Credit Card  
> Type:"/>
>            <h:inputText id="creditcardtype" value="# 
> {accountupdate.creditCardType}" required="false"/ 
> >                           <h:outputText value="Card Number:"/>
>            <h:inputText id="cardnumber" value="# 
> {accountupdate.cardNumber}" required="false"/>                       
> </h:panelGrid>
>        <h:panelGrid columns="4">
>            <h:outputText value="Expiration: "/>
>            <h:panelGroup>
>                <h:selectOneMenu id="expirationMonth" value="# 
> {accountupdate.expirationMonth}">
>                    <f:selectItems value="# 
> {accountupdate.selectedMonths}"/>                       </ 
> h:selectOneMenu>
>            </h:panelGroup>
>            <h:outputText value="Year: "/>
>            <h:inputText id="expirationYear" value="# 
> {accountupdate.expirationYear}" required="false"/>
>        </h:panelGrid>
>        <h:panelGrid columns="2">
>            <h:outputText value="Security Code:"/>
>            <h:inputSecret redisplay="false" value="# 
> {accountupdate.securityCode}" required="false"/>
>        </h:panelGrid>
>        <h:commandButton value="View Order Summary" actionListener="# 
> {accountupdate.saveSummary}"/>
>    </h:panelGrid>
>    </h:panelGrid>
> <h:panelGrid rendered="#{accountupdate.viewOrderSummaryDetail}">
>    <h:outputText value="#{accountupdate.selectedCostDescription}"/>
>    <h:outputText value="Billing Information: "/>     <h:panelGrid  
> columns="2">
>        <h:outputText value="Address: "/>
>        <h:outputText value="#{accountupdate.address}"/>
>        <h:outputText value="City: "/>
>        <h:outputText value="#{accountupdate.city}"/>
>        <h:outputText value="State: "/>
>        <h:outputText value="#{accountupdate.nameState}"/>
>        <h:outputText value="Zip Code: "/>
>        <h:outputText value="#{accountupdate.zipCode}"/>
>    </h:panelGrid>    <h:panelGrid columns="2">                
> <h:commandButton value="Place Order" action="# 
> {accountupdate.saveTierInfo}"/>
>        <h:commandButton value="Back" actionListener="# 
> {accountupdate.backToForm}"/>    </h:panelGrid>
> </h:panelGrid>
> <h:panelGrid rendered="#{!accountupdate.showBillingInformation}">
>    <h:commandButton value="Save" action="# 
> {accountupdate.saveTierInfo}"/>
> </h:panelGrid>
>
> And the following DOES work, the difference is that there is only  
> one selectOneMenu, the other elements were made into regular inputs...
>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
>
> <h:panelGrid rendered="#{!accountupdate.viewOrderSummaryDetail}">
>    <h:selectOneRadio id="selectedTier0" value="# 
> {accountupdate.selectedTier}" layout="pageDirection"  
> valueChangeListener="#{accountupdate.checkSelectedTier}"  
> onclick="submit()" immediate="true">
>        <f:selectItem itemValue="tier1" itemLabel="Tier 1: Account  
> Free" />                      <f:selectItem itemValue="tier2"  
> itemLabel="Tier 2: Account - $ cost per Year" />
>        <f:selectItem itemValue="tier3" itemLabel="Tier 3: Account -  
> $ cost per Year" />
>    </h:selectOneRadio>    <h:panelGrid rendered="# 
> {accountupdate.showBillingInformation}">
>        <h:panelGrid columns="1">
>            <h:outputText value="Billing Information"/>
>        </h:panelGrid>              <h:panelGrid columns="2"  
> cellpadding="50" cellspacing="50">                           
> <h:outputText value="Address:"/>
>            <h:inputText id="address" value="# 
> {accountupdate.address}" required="false"/ 
> >                                  <h:outputText value="City:"/>
>            <h:inputText id="city" value="#{accountupdate.city}"  
> required="false"/>                           <h:outputText  
> value="State: "/>
>            <h:selectOneMenu id="selectedState" value="# 
> {accountupdate.selectedState}">
>                <f:selectItems value="# 
> {accountupdate.countryUSStates}"/>
>            </h:selectOneMenu>
>            <h:outputText value="Zip Code:"/>
>            <h:inputText id="zipcode" value="# 
> {accountupdate.zipCode}" required="false"/>        </h:panelGrid>
>        <h:panelGrid  columns="1">
>            <h:outputText value="Credit Card Details:"/>
>        </h:panelGrid>
>        <h:panelGrid  columns="2">
>            <h:outputText value="Cardholder Name:"/>
>            <h:inputText id="cardholdername" value="# 
> {accountupdate.cardholderName}" required="false"/ 
> >                                 <h:outputText value="Credit Card  
> Type:"/>
>            <h:inputText id="creditcardtype" value="# 
> {accountupdate.creditCardType}" required="false"/ 
> >                           <h:outputText value="Card Number:"/>
>            <h:inputText id="cardnumber" value="# 
> {accountupdate.cardNumber}" required="false"/>                       
> </h:panelGrid>
>        <h:panelGrid columns="5">
>            <h:outputText value="Expiration: "/ 
> >                                   <h:outputText value="Month: "/>
>            <h:inputText id="expirationMonth" value="# 
> {accountupdate.expirationMonth}" required="false"/>
>            <h:outputText value="Year: "/>
>            <h:inputText id="expirationYear" value="# 
> {accountupdate.expirationYear}" required="false"/>
>        </h:panelGrid>
>        <h:panelGrid columns="2">
>            <h:outputText value="Security Code:"/>
>            <h:inputSecret redisplay="false" value="# 
> {accountupdate.securityCode}" required="false"/>
>        </h:panelGrid>
>        <h:commandButton value="View Order Summary" actionListener="# 
> {accountupdate.saveSummary}"/>
>    </h:panelGrid>
>    </h:panelGrid>
> <h:panelGrid rendered="#{accountupdate.viewOrderSummaryDetail}">
>    <h:outputText value="#{accountupdate.selectedCostDescription}"/>
>    <h:outputText value="Billing Information: "/>     <h:panelGrid  
> columns="2">
>        <h:outputText value="Address: "/>
>        <h:outputText value="#{accountupdate.address}"/>
>        <h:outputText value="City: "/>
>        <h:outputText value="#{accountupdate.city}"/>
>        <h:outputText value="State: "/>
>        <h:outputText value="#{accountupdate.nameState}"/>
>        <h:outputText value="Zip Code: "/>
>        <h:outputText value="#{accountupdate.zipCode}"/>
>    </h:panelGrid>    <h:panelGrid columns="2">                
> <h:commandButton value="Place Order" action="# 
> {accountupdate.saveTierInfo}"/>
>        <h:commandButton value="Back" actionListener="# 
> {accountupdate.backToForm}"/>    </h:panelGrid>
> </h:panelGrid>
> <h:panelGrid rendered="#{!accountupdate.showBillingInformation}">
>    <h:commandButton value="Save" action="# 
> {accountupdate.saveTierInfo}"/>
> </h:panelGrid>
>
>
>
> THANKS!
>
>
>