p:calendar calls selectListener method every postback

UI Components for JSF
Post Reply
kwinchester
Posts: 13
Joined: 03 Dec 2010, 19:33

08 Feb 2011, 20:19

I noticed that the p:calendar tag was calling my selectListener method even when I had not changed the date at the client. Looking at the code, I see:

Code: Select all

if(calendar.getSelectListener() != null) {
    calendar.queueEvent(new DateSelectEvent(calendar, convertedValue));
}
There does not seem to be any dependence on whether or not the value was changed, unless I am reading things wrong. In the p:autoComplete tag, which also has a selectListener, I see:

Code: Select all

if (facesContext.getExternalContext().getRequestParameterMap().containsKey(autoComplete.getClientId(facesContext) + "_ajaxSelect")) {
    SelectEvent selectEvent = new SelectEvent(autoComplete, value);
    selectEvent.setPhaseId(PhaseId.INVOKE_APPLICATION);
    autoComplete.queueEvent(selectEvent);
}
which seems to rely on a special request parameter from the client to indicate that a selection was made.

What is the intended behaviour of the selectListener for the p:calendar tag?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Feb 2011, 20:40

Can you replicate it at showcase?

kwinchester
Posts: 13
Joined: 03 Dec 2010, 19:33

08 Feb 2011, 20:50

Unfortunately no, the only showcase example with a selectListener is this one:

http://www.primefaces.org/showcase/ui/calendarAjax.jsf

And it does not have any way to submit the form other than by selecting a date. If you add a p:commandButton to that form, then I believe clicking that button will result in the selectListener being invoked, even if no date selection was made. Is it possible for you to try that out?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Feb 2011, 20:54

Noted down, will check tomorrow.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

14 Feb 2011, 19:24

Fixed now;

http://code.google.com/p/primefaces/iss ... il?id=1737

Thanks for your feedback.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 27 guests