selectonemenu - default value dissapear after selction

UI Components for JSF
Post Reply
kimg
Posts: 61
Joined: 22 Aug 2013, 17:13

22 Jul 2021, 18:24

I'm running PF 10.0.0.

I have a selectonemenu defined like this:

Code: Select all

<p:selectOneMenu id="chair" value="#{setupSystemController.conference.conferenceChair}" style="margin-bottom:10px;"    >
                                    <f:converter converterId="staffConverter"/>
                                    <p:ajax event="valueChange" update="chairEmail"/>
                                    <f:selectItem itemLabel="Select Conference chair" itemValue=""   />
                                    <f:selectItems value="#{setupSystemController.staff}" var="staff" 
                                                   itemLabel="#{staff.firstName} #{staff.lastName}" itemValue="#{staff}"  />
                                </p:selectOneMenu>
when a user selects an option different from the default the default option is not available anymore so the user cant reset the chosen value.

I have tried to copy the basic selectonemenu from PF demo:

Code: Select all

<p:selectOneMenu id="option" value="#{selectOneMenuView.selectedOption}">
                    <f:selectItem itemLabel="Select One" itemValue=""/>
                    <f:selectItem itemLabel="Option1" itemValue="Option1"/>
                    <f:selectItem itemLabel="Option2" itemValue="Option2"/>
                    <f:selectItem itemLabel="Option3" itemValue="Option3"/>
                    <f:facet name="footer">
                        <p:divider styleClass="p-mt-0" />
                        <h:outputText value="3 options" style="font-weight:bold;"/>
                    </f:facet>
                </p:selectOneMenu>
                
and the same happens in my code - the default 'Select One' disappear but it works as expected in the demo.

I'm running Serenity 3.0.1 and when I run the live demo

https://www.primefaces.org/serenity/input.xhtml

it does exactly the same - default value is removed when a drop down value is selected.

Is that intentionally in Serenity?

Kim
Primefaces 6.2 / Glassfish 5 / Payara 5.182

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

23 Jul 2021, 13:13

You might want to ask in the Serenity forum. This definitely sounds theme related.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

DazzlingBob
Posts: 11
Joined: 07 Mar 2019, 15:20

26 Jul 2021, 09:28

Are you using JSF implementation mojarra? Primefaces 10 with older versions of mojarra seems to have a bug in select losing te selected value.
I had to upgrade to mojarra 2.3.15 to solve this.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 38 guests