[ 
http://issues.apache.org/jira/browse/MYFACES-1023?page=comments#action_12366763 
] 

Samuel ROBERT commented on MYFACES-1023:
----------------------------------------

Hello,

I had the same problem, when using the jodatime converter 
(http://l3x.net/imwiki/Wiki.jsp?page=Joda),
which works fine with standard inputText.

Here is the my jsp code :

                    <x:inputCalendar id="endWork" 
monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader"
                        currentDayCellClass="currentDayCell" 
value="#{resourceBackingBean.currentResource.endWork}"
                        renderAsPopup="true" popupTodayString="Today" 
popupWeekString="Week">
                        <joda:convertDateTime type="date" pattern="dd/MM/yy" />
                    </x:inputCalendar>

I fixed the problem by changing HtmlCalendarRenderer's encodeEnd method :

from : 
                inputText.setValue(getConverter(inputCalendar).getAsString(
                        facesContext,inputCalendar,value));

to :
                inputText.setValue(getConverter(inputCalendar).getAsString(
                    facesContext,inputCalendar,inputCalendar.getValue()));


Dont know if it's a consistent correction, and the calendar's behaviour is 
still different with 
or without the converter :
without : when model's date is null, the input is filled with the current date
with : when model's date is null, the input is not filled with anything
(I prefer the second behaviour)


Regards,
Samuel




> inputCalendar with CalendarConverter loses value data
> -----------------------------------------------------
>
>          Key: MYFACES-1023
>          URL: http://issues.apache.org/jira/browse/MYFACES-1023
>      Project: MyFaces
>         Type: Bug
>   Components: Tomahawk
>     Versions: 1.1.1
>  Environment: windows xp pro
>     Reporter: Sven Vogt

>
> When I set a Converter for java.util.Calendar to inputCalendar, the value 
> will not be rendered.
> <t:inputCalendar id="calendar_1"
>                value="#{exampleInputBean.calendar}"
>                renderAsPopup="true">
>       <f:converter converterId="de.orgaplan.faces.CalendarConverter" />
> </t:inputCalendar>
> Because the HtmlCalendarRenderer throws an IllegalArgumentException and set 
> the value to null.
> My Converter is not an Instance of DateConverter.
>         Date value;
>         try
>         {
>             // value = RendererUtils.getDateValue(inputCalendar);
>             Converter converter = getConverter(inputCalendar);
>             if (converter instanceof DateConverter)
>             {
>                 value = ((DateConverter) converter).getAsDate(facesContext, 
> component);
>             }
>             else
>             {
>                 value = RendererUtils.getDateValue(inputCalendar);
>             }
>               }
>         catch (IllegalArgumentException illegalArgumentException)
>         {
>             value = null;
>         }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to