You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jeffrey Porter <PO...@WMGMAIL.wmg.warwick.ac.uk> on 2005/10/31 18:22:02 UTC

selectOneListbox - onclick?

 
 
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> 

 


RE: selectOneListbox - onclick?

Posted by Yee CN <ye...@streamyx.com>.
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>
>
>
>


Re: selectOneListbox - onclick?

Posted by Bruno Aranda <br...@gmail.com>.
Maybe the pattern described at
http://wiki.apache.org/myfaces/SubmitPageOnValueChange is useful to
you,

Regards,

Bruno

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>
>
>
>