4 Replies Latest reply on Jan 20, 2011 8:14 PM by Alexey Makukhin

    How will form behave inside rich:tabPanel?

    Alexey Makukhin Newbie

      Hello everybody!

       

      In richFaces, I have tabPanel inside form:

       

      <h:form>

                          <rich:tabPanel >

                                    <rich:tab header="Модели серверов">

                                              <ui:include src="../refs/serverModels.xhtml" />

                                    </rich:tab>

                                              <rich:tab header="Жесткие диски">

                                    <ui:include src="../refs/hdds.xhtml" />

                                    </rich:tab>

                                    <rich:tab header="Серверные стойки">

                                              <ui:include src="../refs/serverPlaces.xhtml" />

                                    </rich:tab>

                                    <rich:tab header="Процессоры">

                                    wretfd

                                              </rich:tab>

                                    <rich:tab header="Типы сетевых интерфейсов">

                                    agfdsg

                                              </rich:tab>

                          </rich:tabPanel>

      </h:form>

       

      And inclusion "../refs/serverModels.xhtml"

       

      <rich:panel id="serverModels" style="width:100%;">

                          <h:panelGrid columns="2" columnClasses="valTop,valTop">

                                    <h:panelGroup>

                                              <h:form>

                                                        <a4j:region>

                                                                  <h:panelGrid columns="3">

                                                                            <f:facet name="header">

                                                                                      <h:outputText value="Добавление новой модели сервера" />

                                                                            </f:facet>

                                                                            <h:outputText value="Производитель" />

                                                                            <h:selectOneListbox

                                                                                      value="#{ServerModelsView.curModel.serverVendor.idServerVendor}"

                                                                                      id="vendor" size="1" styleClass="input"

                                                                                      validatorMessage="Производитель не выбран!"

                                                                                      title="Выберите производителя сервера"

                                                                                      onchange="checkNewVendor(this)"

                                                                                      disabled="#{ServerModelsView.formState!=1 or rich:isUserInRole('readonly')}">

                                                                                      <f:validateLongRange minimum="1" />

                                                                                      <f:selectItems value="#{ServerModelsView.vendorsList}" />

                                                                            </h:selectOneListbox>

                                                                            <rich:message for="vendor" errorClass="errorMessage" />

                                                                            <h:outputText value="Модель сервера" />

                                                                            <h:inputText value="#{ServerModelsView.curModel.modelName}"

                                                                                      id="serverModel" styleClass="input" required="true"

                                                                                      disabled="#{ServerModelsView.formState!=1}"

                                                                                      requiredMessage="Поле не заполнено!"

                                                                                      validatorMessage="Длина текста менее трех символов!">

                                                                                      <f:validateLength minimum="3" />

                                                                            </h:inputText>

                                                                            <rich:message for="serverModel" errorClass="errorMessage" />

                                                                            <h:outputText value="Поколение" />

                                                                            <h:selectOneListbox

                                                                                      value="#{ServerModelsView.curModel.generation}" id="gen"

                                                                                      size="1" styleClass="input"

                                                                                      disabled="#{ServerModelsView.formState!=1}">

                                                                                      <f:selectItem itemLabel="Нет" itemValue="0" />

                                                                                      <f:selectItem itemLabel="G1" itemValue="1" />

                                                                                      <f:selectItem itemLabel="G2" itemValue="2" />

                                                                                      <f:selectItem itemLabel="G3" itemValue="3" />

                                                                                      <f:selectItem itemLabel="G4" itemValue="4" />

                                                                                      <f:selectItem itemLabel="G5" itemValue="5" />

                                                                                      <f:selectItem itemLabel="G6" itemValue="6" />

                                                                                      <f:selectItem itemLabel="G7" itemValue="7" />

                                                                            </h:selectOneListbox>

                                                                            <h:outputText value="" />

                                                                  </h:panelGrid>

                                                                  <a4j:commandButton value="Добавить сервер"

                                                                            action="#{ServerModelsView.saveServerModel}"

                                                                            render="serverModels,modelsList"

                                                                            disabled="#{ServerModelsView.formState!=1 or rich:isUserInRole('readonly')}" />

                                                        </a4j:region>

                                                        <a4j:region>

                                                                  <a4j:commandButton value="Очистить форму"

                                                                            action="#{ServerModelsView.resetForm}" immediate="true"

                                                                            render="serverModels"

                                                                            disabled="#{ServerModelsView.formState!=1 or rich:isUserInRole('readonly')}" />

                                                        </a4j:region>

                                                        <a4j:region>

                                                                  <a4j:jsFunction name="newVendor"

                                                                            action="#{ServerModelsView.newVendorReq}" render="serverModels"

                                                                            immediate="true" />

                                                        </a4j:region>

                                              </h:form>

                                    </h:panelGroup>

                                    <h:panelGroup rendered="#{ServerModelsView.formState==2}">

                                              <h:form>

                                                        <h:panelGrid columns="3">

                                                                  <f:facet name="header">

                                                                            <h:outputText value="Новый производитель" />

                                                                  </f:facet>

                                                                  <h:outputText value="Производитель:" />

                                                                  <h:inputText value="#{ServerModelsView.curVendor.vendorName}"

                                                                            id="newVendor" required="true"

                                                                            requiredMessage="Поле не заполнено!!!"

                                                                            validatorMessage="Длина текста менее 2 символов!!!">

                                                                            <f:validateLength minimum="2" />

                                                                  </h:inputText>

                                                                  <rich:message for="newVendor" errorClass="errorMessage" />

                                                                  <a4j:commandButton action="#{ServerModelsView.addVendor}"

                                                                            value="Добавить производителя" render="serverModels"

                                                                            disabled="#{rich:isUserInRole('readonly')}" />

                                                                  <a4j:region>

                                                                            <a4j:commandButton action="#{ServerModelsView.cancelVendorReq}"

                                                                                      value="Отмена" render="serverModels" immediate="true"

                                                                                      disabled="#{rich:isUserInRole('readonly')}" />

                                                                  </a4j:region>

                                                        </h:panelGrid>

                                              </h:form>

                                    </h:panelGroup>

                          </h:panelGrid>

                </rich:panel>

       

      In RF3.3.3, inclusion (with subview/jsp:include) worked fine, but now i can't get working form after switch to different tab.

       

      How should i organize those tabPanel and it's content? Or could you advise any overcome for the problem?

       

      Thanks in advance!

       

      -------------------------------

      Addition #1

       

      Included code works fine on the first tab (opened by default). Tabs switch properly. But when tab is switched, new (ajax-rendered) forms do not work.

       

      Message was edited by: Alexey Makukhin