6 Replies Latest reply on May 19, 2009 12:56 PM by jaand96

    Changing commandButton to a4j stops submission of selectOneM

      Hi,

      I have a modalpanel with h:inputText, h:selectOneMenu and h:commandButton to save.

      I need to change the button to be a a4j:commandButton to be able to try this cool trick:
      http://www.jboss.org/community/wiki/ModalPanelValidation

      But when I did this the value-binding for the h:selectOneMenu breaks, however the values in the h:inputText are updated in the backing bean!

      Any suggestions to what I'm doing wrong?


      Sample of the 2 input types and the button:



      
      IS NOT UPDATED
      <s:decorate id="countryDecorate" template="/layout/edit.xhtml">
       <ui:define name="label">Country:</ui:define>
       <h:selectOneMenu id="countrysearch"
       value="#{ProductionPointController.productionPoint.countrycode}">
       <s:selectItems value="#{ProductionPointController.countries}"
       var="country" label="#{country}"
       noSelectionLabel="Pick country" />
       </h:selectOneMenu>
       </s:decorate>
      
      IS UPDATED
      <s:decorate id="idDecorate" template="/layout/edit.xhtml">
       <ui:define name="label">ID:</ui:define>
       <h:inputText id="Id" value="#{ProductionPointController.productionPoint.nationalid}" required="true">
       <a4j:support id="onblur" event="onblur" reRender="idDecorate" />
       </h:inputText>
       </s:decorate>
      
      WORKING BUTTON
       <h:commandButton value="Save" id="save"
       action="#{actionBean[action]}"
       reRender="selectedProductionPointPanel,#{panelid}" />
       <rich:componentControl for="#{panelid}" attachTo="save"
       operation="hide" event="onclick" />
      
      
      


        • 1. Re: Changing commandButton to a4j stops submission of select
          ilya_shaikovsky

          First simple question.. have you read about forms limitations for the modal panel?

          But when I did this the value-binding for the h:selectOneMenu breaks

          clarify this please. Some messages appears?

          also tell more about your environment(RF, JSF versions).

          • 2. Re: Changing commandButton to a4j stops submission of select

            I've read some articles on the jboss wiki and a few other posts, if you have anything else on the topic, that'd be great!

            So when using a a4j:commandButton I get the error when trying to persist. The value bound to the selectOneMenu, ProductionPointController.productionPoint.countrycode is null which not allowed.

            When I use an h:commandButton the value is set to whatever I pick in the drop-down.

            If I change the selectOneMenu to be a inputText it works.

            Using seam 2.1.2 CR1 (richfaces 3.3.0.GA) and Jboss 4.3.

            • 3. Re: Changing commandButton to a4j stops submission of select
              ilya_shaikovsky

               

              I have a modalpanel with h:inputText, h:selectOneMenu and h:commandButton to save.


              show full modal panel code.

              • 4. Re: Changing commandButton to a4j stops submission of select

                So this is working code.
                Now, if I change the save button to be a a4j:commandButton the dropdowns are "ignored"...

                 <h:form>
                 <rich:modalPanel id="basicdetailspanel"
                 trimOverlayedElements="false">
                
                 <f:facet name="header">
                 <h:panelGroup>
                 <h:outputText value="Details"></h:outputText>
                 </h:panelGroup>
                 </f:facet>
                
                 <f:facet name="controls">
                 <h:panelGroup>
                 <h:graphicImage value="/img/close.png" styleClass="hidelink"
                 id="hidelink" />
                 <rich:componentControl for="basicdetailspanel" attachTo="hidelink"
                 operation="hide" event="onclick" />
                 </h:panelGroup>
                 </f:facet>
                
                
                 <div><!-- CONTENT -->
                 <fieldset><h:panelGrid columns="3">
                
                 <s:decorate id="countryDecorate" template="/layout/edit.xhtml">
                 <ui:define name="label">Country:</ui:define>
                 <h:selectOneMenu id="countrysearch"
                 value="#{ProductionPointController.productionPoint.countrycode}">
                 <s:selectItems value="#{ProductionPointController.countries}"
                 var="country" label="#{country}" noSelectionLabel="Pick country" />
                 </h:selectOneMenu>
                 </s:decorate>
                
                 <s:decorate id="idDecorate" template="/layout/edit.xhtml">
                 <ui:define name="label">ID:</ui:define>
                 <h:inputText id="Id"
                 value="#{ProductionPointController.productionPoint.nationalid}"
                 required="true">
                 <a4j:support id="onblur" event="onblur" reRender="idDecorate" />
                 </h:inputText>
                 </s:decorate>
                
                 <s:decorate id="typeDecorate" template="/layout/edit.xhtml">
                 <ui:define name="label">Type:</ui:define>
                 <h:selectOneMenu id="countrysearch"
                 value="#{ProductionPointController.productionPoint.type}">
                 <s:selectItems value="#{ProductionPointController.types}"
                 var="types" label="#{types}" noSelectionLabel="Pick Type" />
                 </h:selectOneMenu>
                 </s:decorate>
                
                 <s:decorate id="nameDecorate" template="/layout/edit.xhtml">
                 <ui:define name="label">Name:</ui:define>
                 <h:inputText id="name"
                 value="#{ProductionPointController.productionPoint.name}"
                 required="true">
                 <a4j:support id="onblur" event="onblur" reRender="nameDecorate" />
                 </h:inputText>
                 </s:decorate>
                
                 </h:panelGrid></fieldset>
                
                
                 </div>
                
                
                 <!-- BUTTONS -->
                 <h:panelGroup>
                
                 <h:commandButton value="Save" id="save"
                 action="#{ProductionPointController.update}" reRender="details" />
                 <h:commandButton value="Cancel" id="cancel" />
                 <rich:componentControl for="basicdetailspanel" attachTo="cancel,save"
                 operation="hide" event="onclick" />
                
                 </h:panelGroup>
                
                 </rich:modalPanel>
                 </h:form>
                


                • 5. Re: Changing commandButton to a4j stops submission of select
                  ilya_shaikovsky

                  modal panel should have its own form inside. you could read about it in corresponding guideline section. Also it has domElementAttachment attribute which reveals this restriction but has some side effects. Also could be explored from tld doc.

                  • 6. Re: Changing commandButton to a4j stops submission of select

                    thanks, form inside the modal panel and under the header facet did the trick.