OpenFaces SuggestionField does not trigger server-side event

125 views Asked by At

I have a problem with the OpenFaces SuggestionField.

I have created a site with a SuggestionField in it and set the suggestionMode to "custom". Then I added a dropDownItems child-tag, which is supposed to get all items to show, right?

Well, and that is my problem, the dropdown-items are empty at start (because in the database there are 20k+ items) and should get filled with already pre-filtered items when the user starts to type something in the field. However, the method never triggers...

Here is the code for the field and the affected method in the backing bean:

<o:suggestionField id="adr" value="#{addressBean.selectedAddressString}" suggestionMode="custom" valueChangeListener="#{addressBean.valueChanged}">
    <f:ajax event="change" execute="adr" render="region x y"></f:ajax>
    <o:dropDownItems value="#{addressBean.addressStrings}"/>
</o:suggestionField>

public List<String> getAddressStrings() {
    String filter = Faces.var("searchString", String.class);
    logger.debug(filter);
    return filter(filter);
}

The method-header for the filter - method is:

private List<String> filter(String filter);

According to this site, the "custom" mode should send an ajax-request to the server.

I added the valueChangeListener attribute as I hoped that at least this gets triggered, but either I have a problem there too, or something is going very wrong...

Anyway, here is the code of this method (yea, it does just log ;-) )

public void valueChanged(ValueChangeEvent vce){
    logger.debug("something changed "+vce.getNewValue());
}

As I know that there are tons of different versions of all components and probably the solutions look different for each, here are the versions I use:

  • OS: Windows 7
  • Server: Tomcat 7.0.42
  • Java: 1.7.0_51
  • JSF: 2.2 (Mojarra 2.2)
  • OpenFaces: 3.1.EA1.1287

Every answer is appreciated, thanks in advance. :-)

1

There are 1 answers

0
greenit On BEST ANSWER

Well, i found my problem.

Openfaces 3.x (including current nightly builds) is not fully compatible with JSF 2.2 (or at least 2.2.6+). As the nightly-doc says, it is currently compatible with 2.1.11.

One of the non-compatibility symptoms is that the suggestionfield does not trigger the server-side event.