myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timm Helbig <timm.hel...@th-hosting.net>
Subject [Trinidad] Problem with dynamic tr:selectOneListbox
Date Thu, 05 Jul 2007 22:11:13 GMT
Hello,

I searched the Mailing List for this, but didn't found a solution. Can someone 
shed some light on me, please

I try to show a list of Products in conjunction to a selected Productgroup. 
The Productgroup is in the Choice and the Product List is showed in a 
Listbox.

Whenever the User changes the Productgroup, a autoSubmit is issued to populate 
the Product List Control with different Products.

This (seems) to work just fine, but when I submit the form, the selection of 
the current Product in the list is always null. The current selection of the 
Productgroup is always valid.

Also, the Productlist valueChangeListener never fires.

Thanks,
Timm

*) Spec
J2EE 5.0.2
JSF 1.2 RI Sun
Facelets 1.1.6/1.1.11/1.1.12 (June 07)
Trinidad 1.0, 1.0.1, 1.2.1

*) The important part of the xhtml file 

<tr:form id="dataForm">
	<tr:panelBox text="#{beanView.displayTitle}">
                <tr:panelFormLayout>

			<tr:selectOneChoice id="groupList" 
				autoSubmit="true"
				valueChangeListener="#{beanView.groupChangeEvent}"
				label="Product Group"
				value="#{beanView.selectedProductGroup}"
				required="true">

				<c:forEach var="r" items="#{beanView.productGroupList}">
					<tr:selectItem label="#{r.value}" value="#{r.key}"/>
				</c:forEach>
			</tr:selectOneChoice>

			<tr:selectOneListbox id="productList"
				size="10"
				partialTriggers="groupList"
				valueChangeListener="#{beanView.productChangeEvent}"
				label="Product List"
				value="#{beanView.selectedProduct}">

				<c:forEach var="p"
					items="#{beanView.productList}">
					<tr:selectItem label="#{p.name}" value="#{p.id}"/>
				</c:forEach>
			</tr:selectOneListbox>

			<tr:commandButton text="Save" 
				action="#{beanView.saveAction}"/>
			</tr:panelFormLayout>
	</tr:panelBox>
</tr:form>

*) The Java Code

public class BillItemBean {

	private String _productGroup;
	private List _groupList

	public List getProductList() {
		if(_productGroup != null && _productGroup.length() > 0) {
			// reading the list from database
		}
		return(null);
	}

	public Number getIdProduct() {
		return(_idProduct);
	}
    
	public void setIdProduct(Number id) {
		_idProduct = id;
	}

	public List<KeyValuePair> getProductGroupList() {
		if(_groupList == null) {
			// Reading groups from database
		}
		return(_groupList);
	}

	public String getSelectedProductGroup() {
		return(_productGroup);
	}
    
	public void setSelectedProductGroup(String group) {
		_productGroup = group;
	}

	public void productChangeEvent(ValueChangeEvent e) {
		// Never fires
	}

	public void groupChangeEvent(ValueChangeEvent e) {
	}

	public String saveAction() {
		// idProduct is always null!
	}
}

Mime
View raw message