You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Yee CN <ye...@streamyx.com> on 2005/11/01 05:06:17 UTC

RE: selectOneListbox - onclick?

Try putting onclick="submit()" as in the following:

<h:selectOneRadio id="category" value="#{CDManagerBean.cd.category}"
  immediate="true"
  onclick="submit()"
  valueChangeListener="#{CDManagerBean.categorySelected}">
    <f:selectItems value="#{CDManagerBean.categories}"/>
</h:selectOneRadio>

Regards,
Yee

-----Original Message-----
From: Jeffrey Porter [mailto:PORTER_J@WMGMAIL.wmg.warwick.ac.uk] 
Sent: Tuesday, 1 November 2005 1:42 AM
To: MyFaces Discussion; yeecn@streamyx.com
Subject: RE: selectOneListbox - onclick?

I wasn't getting the valueChangeListener called when I selected an item
in the list. 

Do you get it called? 
Maybe I made as mistake.
I'll try again.

JP



-----Original Message-----
From: Yee CN [mailto:yeecn@streamyx.com] 
Sent: 31 October 2005 17:39
To: 'MyFaces Discussion'
Subject: RE: selectOneListbox - onclick?

I think you can also do something like the following in your
valueChangeListener method:

	private void setUserToComponents() {
		FacesContext context =
FacesContext.getCurrentInstance();
		UIViewRoot view = context.getViewRoot();
		setInputTextValue(view, "userForm:userId", this.userid);
		setInputTextValue(view, "userForm:name", this.name);
		setInputTextValue(view, "userForm:initial",
this.initial);
		setInputTextValue(view, "userForm:email", this.email);
		setInputTextValue(view, "userForm:division",
this.division);
		setInputTextValue(view, "userForm:position",
this.position);
	}

	private void setInputTextValue(UIViewRoot view, String
componentId,
Object newValue) {
		HtmlInputText input = (HtmlInputText)
view.findComponent(componentId);
		input.setValue(newValue);
	}

Regards,
Yee


2005/10/31, Jeffrey Porter <PO...@wmgmail.wmg.warwick.ac.uk>:
>
>
>
> Not sure if it's possible, can someone comment.
>
> Can you register for events when a list is clicked on?
> i.e. onclick, or valueChangeListener so that other data on the page
can be
> rendered depending on what list item is selected.
>
>
> I tried valueChangeListener, & onclick but with no success.
>
> Thanks
> Jeff
>
> <h:selectOneListbox id="pickCar" value="#{carBean.currentCar}">
>         <f:selectItems value="#{carBean.carList}" />
> </h:selectOneListbox>
>
>
>