2

这是我的表格..

<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>

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

仅当验证失败时才会出现此问题,即使我单击了清除按钮,我也遇到了同样的问题。有人得到这个问题吗?

4

1 回答 1

0

是的,primefaces 中的某些组件确实如此。唯一的解决方案是尝试使用一些其他组件来替换问题组件。或者如果出现错误,则显示错误,如果用户收到错误消息,则编写一个刷新整个屏幕的代码。当然,用户需要再次输入所有详细信息。

于 2013-02-12T09:35:40.017 回答