1
votes

I have an XPage upon which exists a CheckBox Group control. I have code defined for the onclick event to submit the value of the checkbox to a Managed Bean on the server, and also trigger a partial refresh of another element.

This works fine when editing an EXISTING document.

However, when working with a NEW document, the submit never fires.

Here is the code:

<xp:checkBoxGroup
    id="cztypes1"
    value="#{document1.czTypes}"
    required="true"
    layout="pageDirection">
    <xp:this.validators>
        <xp:validateRequired message="You must select at least one Employee Type" />
    </xp:this.validators>
    <xp:selectItem
        itemLabel="Office"
        itemValue="O" />
    <xp:selectItem
        itemLabel="Non-Office"
        itemValue="N" />
    <xp:selectItem
        itemLabel="Sub Contractors"
        itemValue="S" />
    <xp:eventHandler
        event="onclick"
        submit="true"
        refreshMode="partial"
        refreshId="alertRecipients1">
        <xp:this.action><![CDATA[#{javascript:AlertMessage.echo(getComponent("cztypes1").getValue());}]]></xp:this.action>
    </xp:eventHandler>
</xp:checkBoxGroup>

Any ideas?

1

1 Answers

3
votes

Ok, just got this answer from a friend on another forum.

The issue had do to with validators on other controls on the XPage.
Because the lifecycle was processing and failing validation (for other blank fields) this onclick submittal portion was not being processed.

This was demonstrated by adding the immediate=true property to the event handler:

Doing this allowed testing to proceed, and the echo method was then successfully called (with a null value being passed due to the validation failure).

Once the other fields on the XPage were properly filled out, this onclick event worked just fine.