JARCH SHOWCASE
JARCH SHOWCASE
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.
Form
<a:form id="form">
    <a:panel id="panel" header="Form" style="margin-bottom:10px;">
        <a:messages id="messages" />
        <h:panelGrid columns="3" cellpadding="5">
            <a:outputLabel for="text1" value="Text 1:" />
            <a:inputText id="text1" value="#{resetInputView.text1}" required="true" label="Firstname">
                <f:validateLength minimum="2" />
            </a:inputText>
            <a:message for="text1" />

            <a:outputLabel for="text2" value="Text 2:" />
            <a:inputText id="text2" value="#{resetInputView.text2}" required="true" label="Surname"/>
            <a:message for="text2" />
        </h:panelGrid>
    </a:panel>

    <a:toolbar>
        <f:facet name="left">
            <a:commandButton value="Submit" update="panel" actionListener="#{resetInputView.save}" style="margin-right:20px;" />
        </f:facet>

        <f:facet name="right">
            <a:commandButton value="Reset Fail" update="panel" process="@this" actionListener="#{resetInputView.resetFail}" style="margin-right:20px;" />

            <a:commandButton value="Reset Tag" update="panel" process="@this" style="margin-right:20px;" >
                <a:resetInput target="panel" />
            </a:commandButton>

            <a:commandButton value="Reset Code" update="panel" process="@this" actionListener="#{resetInputView.reset}"  style="margin-right:20px;" />

            <a:commandButton value="Reset Non-Ajax" actionListener="#{resetInputView.reset}" immediate="true" ajax="false" style="margin-right:20px;">
                <a:resetInput target="panel" />
            </a:commandButton>

            <h:commandButton value="Reset p:ajax" style="margin-right:20px;" >
                <a:ajax update="panel" resetValues="true" />
            </h:commandButton>
        </f:facet>
    </a:toolbar>
</a:form>
                
JARCH, Copyright © 2022 All rights reserved. Running JARCH 24.3.0-SNAPSHOT on PrimeFaces-12.0.0 on Mojarra-2.3.13.