XPage Combo Box Default Value to Null

Hi there,

This seems like a simple question but I can’t work it out!

I have a combo box in an XPage with a lookup to a set of values. This works fine. However, when the page is loaded, the first value in the list is always selected but I want the combo box to be blank originally as the field is not mandatory.

Does anyone know how to do this? I am getting around the problem at the moment but adding a computed value of:

return " "

This means I cannot do validation though…

Any pointers would be very much appreciated

Ian M

Subject: Fixed

Fixed it!

Add a computed value to the top of ‘values’ reading:

return “”

In the default value add:

return null

Done.

Subject: Try…

<xp:comboBox id="comboBox1" value="#{requestScope.t01}">

	<xp:this.validators>

		<xp:validateRequired

			message="Please select an option from the combo box">

		</xp:validateRequired>

	</xp:this.validators>

	<xp:selectItem itemLabel="Pick something" itemValue=""></xp:selectItem>

	<xp:selectItem itemLabel="AAA" itemValue="AAA"></xp:selectItem>

	<xp:selectItem itemLabel="BBB" itemValue="BBB"></xp:selectItem>

	<xp:selectItem itemLabel="CCC" itemValue="CCC"></xp:selectItem>

</xp:comboBox>

<xp:message id="message1" for="comboBox1"></xp:message>

<xp:br></xp:br>

<xp:button id="button1" value="Submit">

	<xp:eventHandler event="onclick" submit="true"

		refreshMode="complete" immediate="false" save="true">

	</xp:eventHandler>

</xp:button>

http://www.bleedyellow.com/blogs/XPagesStuff/entry/combobox_with_validation?lang=en