myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: t:inputDate and custom converters
Date Wed, 30 May 2007 18:52:36 GMT
I'd call it a bug.

Steven, at minimum, it's probably worth opening a JIRA issue on this.
 Ideally you'd submit a patch to allow a converter to be specified.

On 5/30/07, Andrew Robinson <andrew.rw.robinson@gmail.com> wrote:
> Just looked at the code, the tomahawk input date renderer does not use
> the converter from the component in the 1.1.5 source. From
> HtmlDateRenderer:
>
>     public Object getConvertedValue(FacesContext context, UIComponent
> uiComponent, Object submittedValue) throws ConverterException {
>         UserData userData = (UserData) submittedValue;
>         try {
>             return userData.parse();
>         } catch (ParseException e) {
>             Object[] args = {uiComponent.getId()};
>             throw new
> ConverterException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,
> DATE_MESSAGE_ID, args));
>         }
>     }
>
> Either a bug or a short-coming. I would recommend reporting a new
> issue or feature request and then sub-classing the renderer yourself
> to add support. The one trick to this is that the submitted value is
> not a string as with other UIInput components that I have seen, so it
> doesn't look as simplistic to override. You will have to work with
> UserData and either sub-class it or update its values in the
> converter.
>
> On 5/30/07, Steven Gollery <sgollery@cadrc.calpoly.edu> wrote:
> >
> > I'm having problems getting t:inputDate to use a custom converter class. In
> > the page, I have this:
> >
> > <t:inputDate id="dateOfBirth" type="date" popupCalendar="true"
> >                   value="#{editPatient.dateOfBirth}"
> >                   binding="#{editPatient.dobInput}">
> >     <f:converter converterId="dobConverter"/>
> >     <f:validator validatorId="dobValidator"/>
> > </t:inputDate>
> >
> > And in faces-config.xml:
> >
> >   <validator>
> >         <validator-id>dobValidator</validator-id>
> >
> > <validator-class>com.cdmtech.proj.LHSWebSite.jsf.backingBeans.DOBValidator</validator-class>
> >   </validator>
> >
> >   <converter>
> >      <converter-id>dobConverter</converter-id>
> >
> > <converter-class>com.cdmtech.proj.LHSWebSite.jsf.backingBeans.DOBConverter</converter-class>
> >   </converter>
> >
> >
> > If the values entered by the user can be converted to a date,
> > DOBValidator.validate gets called, as expected. But neither of the Converter
> > methods in DOBConverter ever get called.
> >
> > I've used custom converters before without this problem. Anybody know what
> > I'm doing wrong here?
> >
> > Steven Gollery
> >
> > --
> > View this message in context: http://www.nabble.com/t%3AinputDate-and-custom-converters-tf3842118.html#a10879754
> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >
> >
>

Mime
View raw message