9 Replies Latest reply on Sep 25, 2007 4:23 AM by au lai seong

    selectOneMenu rerender inputText fail inside the form.

    au lai seong Newbie

      The test inputText will not be render. Why? It work fine when i copy the test inputText to outside the form. The following code work also for selectOneMenu rerender other selectOneMenu. Just all the inputText will not be rerender(getter of object in inputText was not be called). Why?

       <h:form id="formEquipMeter">
      
       <rich:simpleTogglePanel id="equipMeterPanel" ajaxSingle="true" switchType="client" opened="false" label="Meters" headerClass="pagetitle" width="99%">
      
      <t:selectOneMenu id="meter" valueChangeListener="#{pmEquipMeterBean.meterChange}" forceId="true"
       value="#{pmEquipMeterBean.pmEquipMeter.id.equipMeterId}" styleClass="text"
       required="true"
      
       <f:selectItems value="#{pmEquipMeterBean.equipMeters}" />
      
       <a4j:support reRender="test" event="onchange" ajaxSingle="true" ignoreDupResponses="true"
       bypassUpdates="false" >
      
       <h:inputText id="test" value="#{pmEquipMeterBean.equipMeter.equipMeterDesc}" ></h:inputText>
      


        • 1. Re: selectOneMenu rerender inputText fail inside the form.
          Sergey Smirnov Master

          Are you sure, it is not rendered?

          hint: The value is not changed and the the component not rendered are not the same things.

          Your t:selectOneMenu tag has not pair ">". Does it mean the code snippet is not the same that you really have

          • 2. Re: selectOneMenu rerender inputText fail inside the form.
            au lai seong Newbie

            I just copy part of the code. I have traced the jsf life cycle. I just can tell you is the getter of the inputText was not be called. It work for selectOneMenu only and not inputText. I copy all my code to here. the test inputText work because it is outside the form. The meterDesc, meterType, meterUnit will not be rerender. Actually 'test' and 'meterDesc' is using the same bean.

            
             <h:inputText id="test" value="#{pmEquipMeterBean.equipMeter.equipMeterDesc}" ></h:inputText>
            
             <h:form id="formEquipMeter">
            
             <rich:simpleTogglePanel id="equipMeterPanel" ajaxSingle="true" switchType="client" opened="false" label="Meters" headerClass="pagetitle" width="99%">
             <a4j:region >
             <h:panelGrid columns="3" width="100%" columnClasses="labelColumn, middleColumn, inputColumn">
            
             <h:panelGroup>
             <pvs:outputLabel for="equipMeter2" value="Equipment" id="equipMeter2Label" forceId="true"/>
             </h:panelGroup>
             <h:outputText value=":" />
             <h:panelGroup>
             <t:selectOneMenu id="equipMeter2" valueChangeListener="#{pmEquipMeterBean.equipChange}" forceId="true"
             value="#{pmEquipMeterBean.pmEquipMeter.id.equipId}" styleClass="text"
             required="true"
             onfocus=" this.style.borderWidth = '2px'; "
             style="border-width: 1px; margin: 1px; background-color: rgb(233, 240, 245); border:1px solid #3664A1">
             <f:selectItems value="#{pmEquipMeterBean.pmEquipsSelectItem}" />
            
             <a4j:support reRender="messages, equipMeter2DivMsg, meter" event="onchange" ajaxSingle="true" ignoreDupResponses="true"
             bypassUpdates="false" onsubmit="this.style.margin = '1px'; this.style.borderWidth = '1px'; this.style.backgroundColor = '#E9F0F5';"/>
            
             </t:selectOneMenu>
             <a4j:outputPanel id="equipMeter2DivMsg" >
             <t:message id="equipMeter2Msg" for="equipMeter2" errorClass="error" fatalClass="error" />
             </a4j:outputPanel>
             </h:panelGroup>
            
             <h:panelGroup>
             <pvs:outputLabel for="meter" value="Meter No." id="meter2Label" forceId="true"/>
             </h:panelGroup>
             <h:outputText value=":" />
             <h:panelGroup>
            
             <t:selectOneMenu id="meter" forceId="true"
             value="#{pmEquipMeterBean.pmEquipMeter.id.equipMeterId}" styleClass="text"
             required="true"
             onfocus=" this.style.borderWidth = '2px'; "
             style="border-width: 1px; margin: 1px; background-color: rgb(233, 240, 245); border:1px solid #3664A1">
             <f:selectItems value="#{pmEquipMeterBean.equipMeters}" />
            
             <a4j:support actionListener="#{pmEquipMeterBean.meterChange}" reRender="messages, meterDivMsg, meterDesc, meterType, meterUnit, test" event="onchange" ajaxSingle="true" ignoreDupResponses="true"
             bypassUpdates="false" onsubmit="this.style.margin = '1px'; this.style.borderWidth = '1px'; this.style.backgroundColor = '#E9F0F5';">
            
             </a4j:support>
            
             </t:selectOneMenu>
             <a4j:outputPanel id="meterDivMsg" >
             <t:message id="meterMsg" for="meter" errorClass="error" fatalClass="error" />
             </a4j:outputPanel>
             </h:panelGroup>
            
            
            


            • 3. Re: selectOneMenu rerender inputText fail inside the form.
              au lai seong Newbie

              It work for h:outputText also but not inputText.

              • 4. Re: selectOneMenu rerender inputText fail inside the form.
                Sergey Smirnov Master

                So, your code works according to the JSF specification. It might be a big surprise (or right to say - a bug) if inputText is rendered with new value in this particular case.
                I will try to find an answer between the old threads. Just a moment...

                • 6. Re: selectOneMenu rerender inputText fail inside the form.
                  au lai seong Newbie

                   


                  whenever component see non-null submitted value during rendering ? it will use it; otherwise if there is non-null local value ? it will use it; finally if no local or submitted values exists ? component will use value from the model


                  Thanka alot. But NULL value mean empty also. value submitted from empty inputText is null?


                  • 7. Re: selectOneMenu rerender inputText fail inside the form.
                    au lai seong Newbie

                    The local value mean the value from getter in restore view phase?

                    • 8. Re: selectOneMenu rerender inputText fail inside the form.
                      Sergey Smirnov Master

                      The local value is a value of the component inside the Component Tree. How it restored (from getter or from other source) is up to concrete component

                      • 9. Re: selectOneMenu rerender inputText fail inside the form.
                        au lai seong Newbie

                        This type of thing really rubbish. Then what is the value holding in component tree?????

                        Now i have problem for selectonemenu. I use javascript to manually select the value but cant get back the value. It like keeping the default value.Is it i cant use javascript to select it or what is missing. it will gave me option is invalid error message. I know it cant populate back the selectitems