I’ve seen 3 different examples of using the “valueChangeListener” attribute.

 

I’ve seen…

 

Example 1:

 

JSP

<h:inputText value="foo">
 <f:valueChangeListener type="com.jsf.MyValueChangeListener"/>
</h:inputText>

 

CODE

public class MyValueChangeListener implements ValueChangeListener {
  public MyValueChangeListener() {  }
 
  public void processValueChange(ValueChangeEvent vce) throws AbortProcessingException  {
     System.out.println("A value has changed!");
  }
}

 

Example 2:

 

JSP

<h:inputText id="partNumber" value="#{nonConformingMaterial.partNumber}" required="true"

valueChangeListener="#{nonConformingMaterial.changeEvent}"

      onclick="submit()"

      immediate="true"

/>  

 

Example 3:

 

JSP

<s:inputSuggestAjax suggestedItemsMethod="#{inputSuggestAjax.getItems}" styleLocation="" />

 

 

 

I like example 3, very sexy. (see http://irian.at/myfaces-sandbox/inputSuggestAjax.jsf)

But it’s not what I need in my application.

 

What I need is, when an inputText is filled in, an action is called so that another inputText field is automatically filled in.

 

I presume that I should be trying to get example 1 working. Would you agree?

 

Reply via email to