0
votes

I have the following in a JSF 2.0 page:

<rich:column styleClass="tbl-weight" id="weight">
                        <f:facet name="header">
                            <h:outputText value="Weight" />
                        </f:facet>

                        <h:outputLabel value="lbs" for="lbs" />
                        <h:inputText size="3" id="lbs" label="lbs"
                            validatorMessage="Lbs must be from 0 to 999"
                            value="#{weighFamilyBacking.weightDecoratorMap[child].lbs}">
                            <f:validateLongRange minimum="0" maximum="999" />
                            <f:ajax event="change" render="@form" immediate="true"/>
                        </h:inputText>

                        <h:outputLabel value="oz" for="oz" />
                        <h:inputText size="3" id="oz" label="oz"
                            validatorMessage="Oz must be from 1 to 15"
                            value="#{weighFamilyBacking.weightDecoratorMap[child].oz}">
                            <f:validateLongRange minimum="0" maximum="15" />
                            <f:ajax event="change" render="currentPayoutOutput" />
                        </h:inputText>

                        <h:message styleClass="error" for="lbs" />
                        <h:message styleClass="error" for="oz" />
                    </rich:column>


                    <rich:column styleClass="tbl-payout" id="currentPayout">
                        <f:facet name="header">
                            <h:outputText id="payout" value="Payout" />
                        </f:facet>
                        <h:outputText id="currentPayoutOutput"
                            value="#{weighFamilyBacking.weightDecoratorMap[child].payout}" />
                    </rich:column>

When looking at this the f:ajax on the "lbs" and "oz" inputs should update set their values and then cause the currentPayoutOutput to render. This works fine only on the first change to the input field.

This is the same results if I use @form or if I use the currentPayoutOutput. Using a phase listener I see it jump from processValidations right to renderResponse. None of the validator messages are showing up.

1

1 Answers

1
votes

The problem ended up being the following:

<f:metadata>
    <f:viewParam name="familyId" value="#{weighFamilyBacking.familyId}" required="true"></f:viewParam>
    <f:event type="preRenderView"
        listener="#{weighFamilyBacking.loadFamily}" />
</f:metadata>

This page takes a familyId as a parameter and it was specified as required. Once I removed this things worked as expected. I assume that since the parameter was there initially it worked the first time. Then on subsequent posts the familyId parameter was no longer there (since it wasn't a hidden form field) and therefor I was jumping from validation right to render phase since the validation of the required "viewParam" was failing.