0
votes

I want to be able to select a value in a radio button in XPages, then use that value to determine the choices in a set of checkboxes.

The choices for the radio button are found using a DbLookup to one view. There is some javascript that puts the text value of the radio button lookup into a hidden field. Based on that value, the checkbox choices are determined with another DbLookup.

I keep fiddling with the code and can never get it to use the updated value of the hidden field to recompute the choices for the checkboxes, even if I display it.

<xp:selectItems>
    <xp:this.value>
    <![CDATA[#{javascript: var viewName=reportDoc.getItemValueString("viewChoice");
    var tmp = @DbLookup(@DbName(),"dbprofile",viewName,"Value");
    @If(@IsError(tmp),"None",tmp)
    }]]></xp:this.value>
</xp:selectItems>

I'm sure this is actually pretty simple, but I just can't figure it.

1

1 Answers

3
votes

You need to set the onChange event of the radio button to partially refresh the checkBox control. This ensures that the values of the checkBox control are refreshed.

The checkBox control can read the value of the radio button control using getComponent("id of radio button control").getValue() and use this value instead of the hidden field for the DbLookup.