multiple selections issue on <p:selectManyCheckbox

UI Components for JSF
Post Reply
Olive
Posts: 16
Joined: 14 Mar 2014, 14:43

16 Apr 2014, 12:03

Hello,

I Have a simple

Code: Select all

<p:selectManyCheckbox id="scopeChoices" value="#{creationModel.selectedOptions}">
			<f:selectItems value="#{referentielModel.requestScopeVos}" converter="scopeConverter"
					var="scope" itemLabel="#{scope.name}" itemValue="#{scope}" />
</p:selectManyCheckbox>
a standard <p:commandButton /> submits the form.

if multiple values are selected, only the last one is posted -is set to the 'selectedOptions' Set-.
After a time-consuming debugging work, I ve figured out that this behaviour only happens when the button (p:commandButton) has not ajax set on (ajax="false")
If I remove 'ajax="false"', multi selections on my selectManyCheckBox are well taken into account. Anyone can explain me that different behaviour of post, on <p:selectManyCheckbox > ?

I HAVE tO use non ajax button, because on this action I am sending and IPC (inter portlet communication) event.
And Ajax button response cannot be cast to action Response :

Code: Select all

ExternalContext externalContext = FacesContext
						.getCurrentInstance().getExternalContext();
ActionResponse actionResponse = (ActionResponse) externalContext
						.getResponse();
logger.debug("Set event : " + qName);
actionResponse.setEvent(qName, requestVo);
anyone can tell me how to post multiple selections of checkbox with non ajax button?

Thanks for your help

Olive
Posts: 16
Joined: 14 Mar 2014, 14:43

18 Apr 2014, 15:13

Hello,

so no one knows why non ajax button cannot post multiple check box selection? (p:commandButton)

this happens as well with <p:selectManyMenu /> component

if ajax="false" is removed on the primefaces commandButton the multiple selection is well posted and the model is well set. But with ajax="false", only the last selection is taken into account


conf:
Jboss7
Liferay 6.1
Primefaces4.0

thanks for any help.

Olive
Posts: 16
Joined: 14 Mar 2014, 14:43

22 Apr 2014, 18:48

Hello agin,

I 've finally got it.

This issue (muliple selections on <p:selectManyMenu/> not taken into account ) has been solved by creating two different forms (h:form): one for standard inputs and one for <p:fileUpload />

O.

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

24 Apr 2014, 11:58

Olive wrote:This issue (muliple selections on <p:selectManyMenu/> not taken into account ) has been solved by creating two different forms (h:form): one for standard inputs and one for <p:fileUpload />
Very good. this is why I 'always' ask people to share 'all' of their code, because IF you did not mention p:fileUpload and p:selectManyMenu were in the same h:form, then that is most likely the reason why no one else responded to this forum topic...earlier.

i just looked at this post, read it, and recognized that you have the solution already. i hope you and others will learn to share as much of your code as possible, so other participating/active users in this forum can provide you a response, quickly/immediately. :)
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

24 Apr 2014, 12:10

smithh032772 wrote: hope you and others will learn to share as much of your code as possible,
But remove aaaaaaallllll the non-relevant stuff from (meaning it is still a fully valid piece of code, so someone can run it). So in fact it should be 'share the most minimal part of your code that still demonstrates the problem'. This also includes bean scopes etc... and even better is to create a fully selfcontained minimalistic example...

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests