Jsf 验证错误后,“重置”按钮不起作用

Jsf 验证错误后,“重置”按钮不起作用,jsf,primefaces,reset,Jsf,Primefaces,Reset,我有一个表单可以添加新用户。我使用验证器消息来控制空字段。如果输入无效数据并提交表单,将显示错误消息。之后,我点击重置按钮,它不工作。 这是我的html代码: <h:form id="newCustomerForm"> <p:dialog draggable="true" header="New Customer" widgetVar="customerDialogNew" resizable="false" showE

我有一个表单可以添加新用户。我使用验证器消息来控制空字段。如果输入无效数据并提交表单,将显示错误消息。之后,我点击重置按钮,它不工作。 这是我的html代码:

<h:form id="newCustomerForm">
    <p:dialog draggable="true"  header="New Customer" widgetVar="customerDialogNew" resizable="false"  
                      showEffect="clip" hideEffect="fold" style="position: absolute ;"  id="dialog2">  
        <p:panelGrid id="newCustomer" columns="6" >  
            <f:facet name="header">  
                <p:graphicImage value="../../pictures/customerAdd.jpg"/>  
            </f:facet>  
            <p:outputLabel value="Name:" for="name" />
            <p:inputText id="name" value="#{customerMB.name}" title="Name" required="true" requiredMessage="The Name field is required."/>
            <p:message for="name" />
            <p:outputLabel value="FamilyName:" for="familyName" />
            <p:inputText id="familyName" value="#{customerMB.familyName}" title="FamilyName" required="true" requiredMessage="The FamilyName field is required."/>
            <p:message for="familyName" />
        </p:panelGrid> 
        <p:commandButton type="reset" immediate="true" update="newCustomerForm" value="Clear" icon="ui-icon-arrowrefresh-1-n" styleClass="ui-priority-primary">
        </p:commandButton>
        <p:commandButton value="Save" ajax="false" icon="ui-icon-circle-check" styleClass="ui-priority-primary" action="#{customerMB.addCustomer()}" /> 
    </p:dialog>  
</h:form>

您能试试重置按钮上的
ajax=“false”
吗?并删除更新。您没有使用任何bean方法来清除此处的字段,而是使用标准的浏览器功能;验证错误之前插入的最后一个数据仍会出现,清除无效:(