Nidheesh
Nidheesh

Reputation: 4562

<p:selectOneMenu> getting null on submit/next

I am using primefaces wizard. During wizard flow all parameters saved correctly . However <p:selectOneMenu> items getting NULL on submit.Also on 'back', it will not show what I have selected. Same for <p:selectManyMenu> also. Any solution ?

Here is the code snippets.I'm using primefaces-3.0.M3 and jsf2.

<h:outputText value="Employee Status" />
<p:selectOneMenu id="employeeStatus"value="#{employeeRepositoryImpl.employeeStatus.title}">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItem itemLabel="Permanent" itemValue="Permanent" />
<f:selectItem itemLabel="Contract" itemValue="Contract" />
<f:selectItem itemLabel="Part-Time" itemValue="Part-Time" />
<f:selectItem itemLabel="Training" itemValue="Training" />
</p:selectOneMenu>
<p:message id="employeeStatusId" for="employeeStatus" />

This is in a <p:wizard> tab, while clicking next button or submit button, the itemValues getting null.Sorry for the re-post.

Upvotes: 0

Views: 2544

Answers (2)

Nidheesh
Nidheesh

Reputation: 4562

I have solved it by using primefaces AJAX

<p:ajax update="employeeStatus" listener="#{employeeRepositoryImpl.employeeStatusAjax}" />

inside my </p:selectOneMenu> and I check/process this in side employeeStatusAjax().

Upvotes: 1

spauny
spauny

Reputation: 5116

Have you deleted the previous post?

Anyway, firstly, you should upgrade to Primefaces 3.0.M4!

Secondly, it would be better to use a list along with f:selectItems and all those String values to be stored in a list(this way you have more control over what's in the list and what should the list return), but if you want to stick with f:selectItem try using it with the enclosing tag (it may be a bug without it):

<f:selectItem itemLabel="Permanent" itemValue="Permanent" ></f:selectItem>

Also, I repeat myself, upgrade to Primefaces 3.0.M4!

Upvotes: 2

Related Questions