2
votes

I am developing an Application with Primefaces 3 and the p:selectOneMenu just doesn't work.

The first option is always selected and when I press the drop-down button to the right nothing happens. h:selectOneMenu works just fine, but I want the style of the primefaces component.

<h:form>
  <!-- Country-->
  <div class="control-group">
    <label class="control-label">Country</label>
    <div class="controls">
      <p:selectOneMenu value="#{userService.sessionBean.currentUser.country}">
        <f:selectItem itemLabel="Austria" itemValue="Austria" />
        <f:selectItem itemLabel="Germany" itemValue="Germany" />
        <f:selectItem itemLabel="Italy" itemValue="Italy" />
      </p:selectOneMenu>
    </div>
  </div>
  <div class="form-actions">
    <p:commandButton type="submit" id="submitButton" action="#{userService.update()}" value="Update your Profile" styleClass="btn btn-primary btn-large" ajax="false">
      <f:param name="update" value="true" />
    </p:commandButton>
  </div>
</h:form>

I even copied the showcase example from the primefaces homepage but it still does not work. I tested this also at a friends computer and with firefox and chrome on Ubuntu and Mac OS X.

Is this a problem with my Primefaces Version (3.5)?

1
I have just tested with Primefaces's selectOneMenu, it work fine, so what you mean "p:selectOneMenu does not work" ?Rong Nguyen
Please provide more Information so the question is more answerable. Is there any Exception thrown? Make sure that #{userService.sessionBean.currentUser.country} does not throw any Nullpointer Exception. What does your Backing Bean look like?Sonic
+1 doesn't work for me as well on PF 4.0 SNPSHT with myfaces 2.1.11/ tomcat, no exceptions/errors.. just unresponsive dropdown.. h:selectoneMenu works fine thoughRajat Gupta
I have the same problem (JSF 2.2, PrimeFaces 4.0). When I use p:selectOneMenu with f:selectItems inside, the dropdown list is unresponsive. If I replace p:selectOneMenu with h:selectOneMenu, it works fine.vtomic85
Same behavior for me too: MyFaces 2.0.8 and PrimeFaces 5.1 - dropdown is displayed with first item in list selected, but clicking it does not drop down the list. Browser developer tools show a list of options on the rendered select element, but it acts as if it's disabled.Kevin Hooke

1 Answers

2
votes

I commented on this issue over a year ago, but just ran into the same issue and found this post again when looking for a solution.

The fix in my case was that the page had an import of an older version of jQuery (1.11.2) that was clashing with the jQuery that PrimeFaces uses and imports to the page.

I removed my jQuery import and the p:selectOneMenu now drops down and works as expected.