Mario,

You can do something like this:

FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot view = context.getViewRoot();

HtmlInputText input = (HtmlInputText) view.findComponent("myForm:myInput");
input.setValue("new value");

It works, but it doesn't seems to be an ideal solution to me.

Regards,
Yee


-----Original Message-----
From: Mario Ivankovits [mailto:[EMAIL PROTECTED] 
Sent: Monday, 21 November 2005 9:17 PM
To: MyFaces Discussion
Subject: valueChangeListener and modelUpdate question

Hi!

I have something like this in my jsf

<h:inputText value="#{replacementItems.searchArt}" size="10" 
maxlength="40" />
<h:commandButton value="Suchen" 
action="#{replacementItems.searchArtAction}" />
      
<h:selectOneMenu
        value="#{replacementItems.catalog}"
        onchange="submit()"
        valueChangeListener="#{replacementItems.catalogSelected}">
    <f:selectItems value="#{replacementItems.catalogs}" />
</h:selectOneMenu>

As you can see there is a valueChangeListener in my selectOneMenu.

Within my valueChange method I would like to reset the value of my 
inputText component.
Also I throw an AbortProcessingException then to avoid another 
valueChangeListener to be fired.

Unhappily this doesnt work as it seems the model update is AFTER the 
fireing of the valueChangeListeners.
Thus my change will be overwritten by the model update.

Is there a way around it?
I also tried "FacesContext.getCurrentInstance().renderResponse()" but 
this also doesnt work as expected.

Thanks!
Mario

Reply via email to