簡體   English   中英

JSF Primefaces selectOneMenu 組件問題

[英]JSF Primefaces selectOneMenu component issue

父頁面.xhtml

<h:form id="newGame" enctype="multipart/form-data">
<h:panelGroup id="newGameid">
    <p:growl id="growl" sticky="true" showDetail="true" />
    <p:wizard id="newGameWizard" showNavBar="true" widgetVar="gameWiz" flowListener="#{javaMB.wizardFlow}">
            <p:tab id="gameTab"   title="Form">
                <ui:include src="/jsf/required.xhtml" />
                <ui:fragment rendered="#{javaMB.pageType.pageTypeId eq 1}">
                    <ui:include src="/jsf/page1.xhtml" />
                </ui:fragment>
                <ui:fragment rendered="#{javaMB.pageType.pageTypeId eq 2}">
                    <ui:include src="/jsf/page2.xhtml" />
                </ui:fragment>
            </p:tab>
   <p:tab title="Submit"   id="certifySubmit" >
                    <ui:include src="/jsf/submission.xhtml" />      
            </p:tab>
 </p:wizard>
 </h:panelGroup>
 </h:form>

頁面1.xhtml

 <ui:composition xmlns="http://www.w3.org/1999/xhtml"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:p="http://primefaces.org/ui"
 xmlns:f="http://java.sun.com/jsf/core"
    xmlns:pe="http://primefaces.org/ui/extensions"
 >
 <style>
 .borderClass {
 border-color: #DEEFFF;
 border-width: 2px;
 border-style: solid;
 }
 </style>
 <p:panel id="information" styleClass="panelNoBorder">
    <p:fieldset toggleable="true"  toggleSpeed="500" legend="Information">

            <p:outputLabel value="Machine Generated"/>
            <p:inputText id="machinegenerated"   value="#{javaMB.machinegenerated}"  >


            <p:selectOneMenu id="Selectpartsby" required="true" style="width:150px" value="#{javaMB.partType.partBy}">
            <f:selectItem itemLabel="Parts By:" itemValue="" noSelectionOption="true" />
            <f:selectItems value="#{javaMB.partTypeList}" />
            <p:ajax update="other2" process="@this" />
        </p:selectOneMenu>

            <p:inputText id="other2"   required="#{javaMB.partType.partBy eq 4}" value="#{javaMB.otherfield}"  >



       </p:fieldset>
    </p:panel>
 </ui:composition>

page2.xhtml

 <ui:composition xmlns="http://www.w3.org/1999/xhtml"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:p="http://primefaces.org/ui"
 xmlns:f="http://java.sun.com/jsf/core"
    xmlns:pe="http://primefaces.org/ui/extensions"
 >
 <style>
 .borderClass {
 border-color: #DEEFFF;
 border-width: 2px;
 border-style: solid;
 }
 </style>
 <p:panel id="information2" styleClass="panelNoBorder">
    <p:fieldset toggleable="true"  toggleSpeed="500" legend="Information">

            <p:outputLabel value="Manual Entry"/>
            <p:inputText id="manualentry"   value="#{javaMB.manualentry}"        >

            <p:selectOneMenu id="Selectpartsby6" required="true" style="width:150px" value="#{javaMB.partType.partBy}">
            <f:selectItem itemLabel="Parts By:" itemValue="" noSelectionOption="true" />
            <f:selectItems value="#{javaMB.partTypeList}" />
            <p:ajax update="other6" process="@this" />
        </p:selectOneMenu>

             <p:inputText id="other6"   required="#{javaMB.partType.partBy eq 4}" value="#{javaMB.otherfield}"  >



       </p:fieldset>
    </p:panel>
 </ui:composition>

兩個下拉菜單在同一個表中具有相同的值

下拉菜單 - Parts By User 必須選擇一個選項

 Database
 ID name
 1 NES
 2 SONY
 3 WII
 4 OTHER

如果為“Parts By”選擇了其他,則需要輸入文本

下拉菜單,如果未選擇其他功能,則輸入值所需的錯誤工作正常,

問題出在頁面 2 單擊“下一步”后,它不會轉到下一個選項卡

如果我刪除頁面 2中的selectOneMenu 組件,則它會轉到下一個選項卡。

我嘗試使用 Chrome 開發者工具,但找不到任何錯誤,

試圖在 flowListener 向導流方法中放置一個調試指針,甚至沒有命中它。

第 1 頁工作正常。

任何想法如何修復/解決?

從行為來看,似乎缺少一個必填字段,但由於缺少 required.xhtml 和 JavaMB 代碼,我無法告訴您真正的原因。 您可以在瀏覽器開發人員工具中檢查 ajax 是否為咆哮返回一些消息/錯誤(因為它沒有自動更新或更新,您無法直接看到)。 您還必須在每次更改 javaMB.partType.partBy 值時檢查必填字段是否更新。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM