Bug Calendar processUpdates / updateModel

UI Components for JSF
LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

14 Jan 2019, 13:08

Dear all.

I've got the following structure in my app:
- h:form
-- composite:component
--- p:calendar

The calendar is set up like this:

Code: Select all

	<p:calendar
		id=..."
		value="#{cc.attrs.valueFrom}" 
		pattern="dd.MM.yyyy"
		locale="de"
		navigator="true"
		converter="#{cc.attrs.converter}"
		styleClass="..."
		disabled="..."
		required="...">
		<p:ajax ... 
IMPORTANT: the value is a String object and the converter is a LocalDate -> String converter!

When entering a date with navigator or directly the conversion in the calender class is called and the conversion to String is correctly done by the converter. Ajax is also called, everything looks ok.

Now the problem:
When submitting the form and executing a search the calendar first takes the value correct and tries to submit the form. During rerendering the calender wants to rerender the input value, but it does not use the given pattern or converter, it uses the standard function of UIInput class.

The following methods were called:
- ...
- Calender(UIInput).processUpdates
- Calender(UIInput).updateModel
- ...
- ELSupport.coerceToType
- ...
- ELSupport.coerceToString
- LocalDate.ToString


Because LocalDate.toString gives a yyyy-MM-dd value, the value of the calender is in the wrong format.

In my app, the user can save the input values of a search, and the saved format is wrong then. Should be dd.MM.yyyy but is yyyy-MM-dd.

I think it is a bug, the Calender class should override the methods of UIInput to use the converter to get the correct String format of the input. PF version is 6.1.

kind regards

Lars

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

14 Jan 2019, 16:48

Tried PF 6.2(.x) or 6.3-SNAPSHOT?

LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

15 Jan 2019, 08:48

The API says it would make no difference because the methods are the same..
https://www.primefaces.org/docs/api/6.2 ... endar.html

Lars

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

15 Jan 2019, 12:04

An API is not an implementation... ;-)

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

15 Jan 2019, 14:26

Yes please always test with the latest code. There are a lot of time something has long since been fixed.
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

LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

16 Jan 2019, 15:52

PF 6.2 has the same problem.

According to the current implementation...

org.primefaces.component.calendar.Calendar
<- org.primefaces.component.calendar.CalendarBase
<<- org.primefaces.component.api.UICalendar
<<<- javax.faces.component.html.HtmlInputText
<<<<- javax.faces.component.UIInput

The class UIInput implements the mentioned methods which end up in the LocalDate.toString method as described.

The missing code should be implemented in some of the Calendar classes to use the converter instead of ELSupport.coerceToType as a fallback.


kind regards

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

16 Jan 2019, 16:04

OK do me a favor and create a small reproducible example using the PF Test project: https://github.com/primefaces/primefaces-test

Then submit the issue to the GitHub issues page.
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

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

17 Jan 2019, 17:18

Please try 7.0RC1 since things have been 'fixed' in the calendar between 6.2 and now

LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

29 Jan 2019, 07:58

I cannot change the PF version so easily. Looks like this is a gerneral issue which is not going to be fixed soon. :cry:

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

29 Jan 2019, 14:29

LarsD please report an issue on Github issues. if you don't report an issue on the GitHub page with a reproducible example then how can developers debug and fix your issue?
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

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests