XPage - Combobox computed value doesn't recognise requestScope

I’m using a requestScope variable to pass the value of one combobox to another. The variable can be used in an Editbox control, but returns null inside the Values tab of a Combobox.

I’m using Designer 8.5 (Revision 20081211.1925) and I get the same problem using IE 7 or Firefox 2.0

Any ideas on why this doesn’t work?

This is the complete source:

<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp=“http://www.ibm.com/xsp/core”>

<xp:comboBox id=“Topic1”>

	<xp:selectItem itemLabel="1"></xp:selectItem>

	<xp:selectItem itemLabel="2"></xp:selectItem>

	<xp:selectItem itemLabel="3"></xp:selectItem>

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

		refreshMode="complete">

		<xp:this.action><![CDATA[#{javascript:var topic = getComponent("Topic1").getValue();

requestScope.put(“topic1”, topic);

}]]></xp:this.action>

	</xp:eventHandler>

</xp:comboBox>

<xp:br></xp:br>

<xp:comboBox id="Topic2">



	<xp:selectItems>

		<xp:this.value><![CDATA[${javascript:var topic = requestScope.get("topic1");

if (topic == null || topic == “”){

return "topic has no value";

} else {

return topic;

};

}]]></xp:this.value>

	</xp:selectItems>

</xp:comboBox>

<xp:br></xp:br>



<xp:inputText id="inputText1"><xp:this.value><![CDATA[#{javascript:var topic = requestScope.get("topic1");

if (topic == null || topic == “”){

return "topic has no value";

} else {

return topic;

}}]]></xp:this.value></xp:inputText></xp:view>

Subject: Possible sollution without scopes

Hello Shaun,

I run into the same Problem. and found that.
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/18112008060153WEBEXS.htm

This gave me the idea to another way without using scopes:

The first box:
-------------schnipp-----------------

<xp:listBox value=“#{document1.cmbKategorie}” size=“1” id=“cmbKategorie”>

<xp:selectItem

	itemLabel="&lt;Bitte eine Kategorie auswählen&gt;"

	itemValue="&lt;Bitte eine Kategorie auswählen&gt;">

</xp:selectItem>

<xp:selectItems>

<xp:this.value><![CDATA[${javascript:@DbColumn("","categories-de",1)}]]></xp:this.value>

</xp:selectItems>

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

	refreshMode="partial" refreshId="cmbUnterkategorie">

</xp:eventHandler>

</xp:listBox>

-------------schnipp-----------------

Gets it’s values out of a view and calls a refresh of the second combo box and has an additional text, to show the user that (s)he has to do some action.

The second box :

-------------schnipp-----------------

<xp:listBox id=“cmbUnterkategorie” size=“1”

value="#{document1.cmbUnterkategorie}">

<xp:selectItems>

<xp:this.value><![CDATA[#{javascript:var sc = @Text(document1.getItemValue("cmbKategorie"));

var leer = @Text(“<Bitte eine Kategorie auswählen>”);

var voll = @DbLookup(“”,“categories-de”,sc,2);

@If(sc == “”,@Return(leer),@Return(voll))}]]>

</xp:this.value>

</xp:selectItems>

</xp:listBox>

-------------schnipp-----------------

The second box shows an additional text, which says, that the first Box must be selected.

If the first Box is selected, the second is filled with values out of a view.

The view has two columns:

first : @Text(Values of Category) → sorted and categoriezed

second: Values of the subcategories.

At the moment i work on the Validation, so i can not say, that is the best way… :slight_smile:

Wolfgang