Primefaces验证后无法在表格中输入任何内容?

时间:2013-01-19 14:36:31

标签: jsf primefaces

这是我的表格..

<p:panel id="panel" header="Portfolio Transaction">
            <p:messages id="msgs" />

            <p:panelGrid columns="7" id="transactionPanel" style="display: inline-block;">
                <f:facet name="header"> 
                    Register New Trade
                </f:facet>

                <h:outputLabel for="tipsSuggestionBoxId" value="Company Name:*"></h:outputLabel>

                <h:outputText value="Date:*" />

                <h:outputText value="Type:*" />

                <h:outputText value="Quantity:*" />

                <h:outputText value="Price:*" />

                <h:outputText value="Brokerage:" />

                <h:outputText value="Notes:" />

                <p:autoComplete id="tipsSuggestionBoxId"
                    completeMethod="#{portfolioTransactionBean.autoSelectCompany}"
                    value="#{portfolioTransactionBean.txnCurrentRecord.companyName}"
                    minChars="3" nothingLabel="No similar company found"
                    requestDelay="1" minQueryLength="3" required="true"
                    requiredMessage="Company Name Cannot be empty">
                </p:autoComplete>

                <p:calendar id="from_date" size="10" required="true"
                    requiredMessage="Date Cannot be empty"
                    value="#{portfolioTransactionBean.txnCurrentRecord.umptTransDate}"
                    mode="popup" showOn="both" pattern="dd/MM/yyyy"
                    popupIconOnly="true" readonly="#{facesContext.renderResponse}">
                </p:calendar>

                <p:selectOneMenu id="tranType"
                    value="#{portfolioTransactionBean.txnCurrentRecord.umptTransType}">
                    <f:selectItem itemLabel="Transaction Type" itemValue="" />
                    <f:selectItem itemLabel="Buy" itemValue="Buy" />
                    <f:selectItem itemLabel="Sell" itemValue="Sell" />
                </p:selectOneMenu>


                <p:spinner id="transQuntity" required="true"
                    value="#{portfolioTransactionBean.txnCurrentRecord.umptQty}" min="1"    label="Quanity" size="5"
                    validatorMessage="Field Is mandatory" />

                <p:spinner id="transPrice" required="true" size="5"
                    value="#{portfolioTransactionBean.txnCurrentRecord.umptPrice}"
                    label="Price"
                    validatorMessage="Field Is mandatory" />



                <p:spinner id="brokerage" size="5"
                    value="#{portfolioTransactionBean.txnCurrentRecord.umptBrokerage}"  />

                <h:inputText
                    value="#{portfolioTransactionBean.txnCurrentRecord.umptNotes}" />

                <f:facet name="footer">
                    <p:commandButton value="Save Transaction " icon="ui-icon-check"
                        action="#{portfolioTransactionBean.savePortfolioTransaction}"
                        update="panel" style="float:right;right:20%;">
                        <p:resetInput target="transactionPanel" />
                    </p:commandButton>
                    <p:spacer width="100" height="10" />
                    <p:commandButton value="Clear" update="transactionPanel"
                        process="@this">
                        <p:resetInput target="transactionPanel" />
                    </p:commandButton>
                </f:facet>


            </p:panelGrid>

表单验证失败后,如用户没有输入日期或公司名称,我能够看到正确的消息,但之后我无法从keybord输入任何值。任何人都知道代码有什么问题。

只有在验证失败时才会出现此问题,即使我点击了清除按钮我也遇到同样的问题。有谁得到这个问题?

1 个答案:

答案 0 :(得分:0)

是的,对于primefaces中的一些组件来说确实如此。唯一的解决方案是尝试使用一些替代problamatic组件的其他组件。或其他明智的,如果有错误显示错误,并编写一个代码,如果用户收到错误消息刷新整个屏幕。当然,用户需要再次输入所有细节。