ResetInput

Input components keep their local values at state when validation fails. ResetInput is used to clear the cached values from state so that components retrieve their values from the backing bean model instead.

New User

Source

<h:form id="form">

    <p:panel id="panel" header="New User" style="margin-bottom:10px;">
        <p:messages id="messages" />
        <h:panelGrid columns="3">
            <h:outputLabel for="firstname" value="Firstname: *" />
            <p:inputText id="firstname" value="#{pprBean.firstname}" required="true" label="Firstname">
                <f:validateLength minimum="2" />
            </p:inputText>
            <p:message for="firstname" />

            <h:outputLabel for="surname" value="Surname: *" />
            <p:inputText id="surname" value="#{pprBean.surname}" required="true" label="Surname"/>
            <p:message for="surname" />
        </h:panelGrid>
    </p:panel>

    <p:commandButton value="Submit" update="panel" actionListener="#{pprBean.savePerson}" />
                
    <p:commandButton value="Reset Fail" update="panel" process="@this" actionListener="#{pprBean.resetFail}" />

    <p:commandButton value="Reset Tag" update="panel" process="@this"  >
        <p:resetInput target="panel" />
    </p:commandButton>

    <p:commandButton value="Reset Code" update="panel" process="@this" actionListener="#{pprBean.reset}" />

    <p:commandButton value="Reset Non-Ajax" actionListener="#{pprBean.reset}" immediate="true" ajax="false">
        <p:resetInput target="panel" />
    </p:commandButton>

    <h:commandButton value="Reset p:ajax" style="margin-right:20px;" >
        <p:ajax update="panel" resetValues="true" />
    </h:commandButton>

</h:form>