简体   繁体   English

JSF Primefaces selectOneMenu 组件问题

[英]JSF Primefaces selectOneMenu component issue

Parentpage.xhtml父页面.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>

page1.xhtml页面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 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>

The both the drop downs have the same values from the same table两个下拉菜单在同一个表中具有相同的值

Dropdown - Parts By User must select an option下拉菜单 - Parts By User 必须选择一个选项

 Database
 ID name
 1 NES
 2 SONY
 3 WII
 4 OTHER

The inputText is required if Other is selected for 'Parts By'如果为“Parts By”选择了其他,则需要输入文本

The drop downs , and if the other functionality is not selected then the error for the required for the input value works fine,下拉菜单,如果未选择其他功能,则输入值所需的错误工作正常,

The issue is in the page 2 Upon clicking Next It does not go to the next tab问题出在页面 2 单击“下一步”后,它不会转到下一个选项卡

If I remove the selectOneMenu component in the page 2 then it goes to the next tab.如果我删除页面 2中的selectOneMenu 组件,则它会转到下一个选项卡。

I tried using the Chrome Developer Tools, but could not find any erros,我尝试使用 Chrome 开发者工具,但找不到任何错误,

Tried to place a debug pointer in the flowListener wizardflow method, Does not even hit it.试图在 flowListener 向导流方法中放置一个调试指针,甚至没有命中它。

the page 1 works fine.第 1 页工作正常。

Any ideas how to fix/resolve?任何想法如何修复/解决?

From the behaviour it seems a required field missing, but since required.xhtml and JavaMB code are missing I can't tell you the real reason.从行为来看,似乎缺少一个必填字段,但由于缺少 required.xhtml 和 JavaMB 代码,我无法告诉您真正的原因。 You can check, in the browser developer tool, if the ajax is returning some message/error for the growl (since it's not with auto update or updated, you can't see directly).您可以在浏览器开发人员工具中检查 ajax 是否为咆哮返回一些消息/错误(因为它没有自动更新或更新,您无法直接看到)。 You have also to check if the required fields are update everytime you change javaMB.partType.partBy value.您还必须在每次更改 javaMB.partType.partBy 值时检查必填字段是否更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM