user1358852
user1358852

Reputation:

XPages - field update not working when a required field is present

I'm updating a field using partial refresh which works fine except when a required field is present. Then the update does not work at all. Can anyone explain why? Here is my code.

<xp:panel rendered="true">
    <xp:table>

        <xp:tr>
            <xp:td>My Value:</xp:td>
            <xp:td>
                <xp:inputText id="ValueField"
                    value="#{document1.ValueField}">
                </xp:inputText>
            </xp:td>
        </xp:tr>
        <xp:tr>
            <xp:td>Required Field:&#160;</xp:td>
            <xp:td>
                <xp:inputText id="inputText1" required="true"></xp:inputText></xp:td>
        </xp:tr>
    </xp:table>
</xp:panel>

<xp:panel rendered="true">
    <xp:table>
        <xp:tr>
            <xp:td>
                <xp:button id="button3" value="Set Value">
                    <xp:eventHandler event="onclick" submit="true"
                        refreshMode="partial" refreshId="ValueField">
                        <xp:this.action><![CDATA[#{javascript:document1.setValue("ValueField","12345")}]]></xp:this.action>
                    </xp:eventHandler>
                </xp:button>
            </xp:td>
        </xp:tr>
    </xp:table>
</xp:panel>

The update works fine if the required attribute for inputText1 is set to false.

This question is similar to my previous query but for the sake of clarity I decided to post it separately.

Upvotes: 1

Views: 167

Answers (1)

Fredrik Norling
Fredrik Norling

Reputation: 3484

The way around this is to check the box "process data without validation" on the event tab

The validation phase is processed in the JSF lifecycle, if you do a full or a partial refresh and thats why no fields is updated.

Upvotes: 5

Related Questions