You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by magdolna holitska <mh...@hotmail.com> on 2007/01/24 00:32:25 UTC

Custom messages for converters

Hi all,

I have been trying, unsuccessfully to customize the error messages generated 
by a date/time converter (tr:convertDateTime).

- I tried to add the message id to my resources file 
(org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
- I tried to use the attribute convertBothMessageDetail
- I tried to create my own converter class by extending Trinidad converter 
and use the setConvertBothMessageDetail method to set the custom message

It appears that it only works if I don't set the pattern.
As soon as I am setting the pattern I get a default validation text (The 
value "xxx" is not a valid date. Valid example: "Nov-29-2005 15:45:24".)

Validator messages seem to be easily customizable, but not converters.
Could please someone point out what I am missing here?

Thank you,
Magdolna

_________________________________________________________________
Windows Live Spaces: share your New Year pictures! 
http://discoverspaces.live.com/?loc=en-CA


RE: Custom messages for converters

Posted by Anshuman Abhishek Roy <an...@in.ness.com>.
Hi Magodlna,
 
Many thanks for the information.
I will implement this right away.
 
regards,
Anshuman

________________________________

From: magdolna holitska [mailto:mholitska3@hotmail.com]
Sent: Wed 1/31/2007 3:56 AM
To: adffaces-user@incubator.apache.org
Subject: RE: Custom messages for converters



Hi Anshuman,

You could just try something like:
<tr:inputText label="test" converter="myCustomDateTimeConverter"/>

As the message is set in the converter you could use if-else logic or
something similar to set different messages. Note that you don't have to
hard code the actual messages, you can still store them externally in a
properties file - same for the pattern.

Regards,
Magdolna





>From: "Anshuman Abhishek Roy" <an...@in.ness.com>
>Reply-To: adffaces-user@incubator.apache.org
>To: <ad...@incubator.apache.org>
>Subject: RE: Custom messages for converters
>Date: Fri, 26 Jan 2007 19:54:05 +0530
>
Nice suggestion Matthias.

But then how do we configure this new datetime converter class in your faces
application.

is it via using something like this:
<converter>

<converter-id>javax.faces.DateTime</converter-id>

<converter-class>test.converter.CustomDateTimeConverter</converter-class>

</converter>


in the faces-config.xml?

One more thing this will lead to the problem of what if I want to display
different messages in different places for the same <tr:convertDatetime>?

Can it be done programatically by catching hold of the UIXComponent and then
setXXX() methods on to the UIXComponent?

regards,
Anshuman

________________________________

From: mwessendorf@gmail.com on behalf of Matthias Wessendorf
Sent: Fri 1/26/2007 12:48 PM
To: adffaces-user@incubator.apache.org
Subject: Re: Custom messages for converters



well, at least you can create a custom converter, which isn't really to much
:)

You also could extend the standard datetimeconverter and override the
getAsXxx and catch the exceptions, to throw your own.

-M

On 1/25/07, magdolna holitska <mh...@hotmail.com> wrote:
>Hi,
>
>I just would like to share my findings, after upgrading to the latest
>version of Trinidad:
>
>1. -- Overriding
>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH and
>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
>did not work
>
>2. -- messageDetailConvertBoth works, as long as you don's set the pattern
>As I understood this is intentional, to only allow customization of the
>message if the pattern is not set (I don't know why)
>
>3. -- for achieving both customize message and also set the pattern, I
>ended
>up writing my own converter. It's really easy, I just extended
>javax.faces.convert.Converter and set the pattern and the error message to
>whatever I needed. I'm not sure if that's the best way to do it, but I
>didn't find a nicer way so far.
>
>Regards,
>Magdolna
>
>
>
>
>
>
> >From: "magdolna holitska" <mh...@hotmail.com>
> >Reply-To: adffaces-user@incubator.apache.org
> >To: adffaces-user@incubator.apache.org
> >Subject: Re: Custom messages for converters
> >Date: Wed, 24 Jan 2007 14:32:35 -0500
> >
> >Hi Matthias,
> >
> >Thank you for pointing that out to update to a newer version of Trinidad,
>I
> >will follow your advice.
> >
> >Also, I tried to override CONVERT_BOTH_detail, but no luck yet.
> >I will try again after I switch to the new version.
> >
> >However, the description in the messageDetailConvertBoth attribute really
> >caught my eye:
> >"... if pattern is not set or is null".
> >To me this sounds like if the pattern is set and not null, the message
> >customization is ignored.
> >Just something I felt that I should point out.
> >
> >Thank you for all your help,
> >Magdolna
> >
> >
> >
> >
> >
> >>From: "Matthias Wessendorf" <ma...@apache.org>
> >>Reply-To: adffaces-user@incubator.apache.org
> >>To: adffaces-user@incubator.apache.org
> >>Subject: Re: Custom messages for converters
> >>Date: Wed, 24 Jan 2007 15:17:49 +0100
> >>
> >><tr:inputText label="test">
> >>  <tr:convertDateTime
> >>   type="both"
> >>   messageDetailConvertBoth="Well,the value ({1}) is not really in a
> >>propper format, like {2}"
> >>  />
> >></tr:inputText>
> >>
> >>works for me w/ latest trinidad (check the trunk)
> >>
> >>the messageDetailConvertBoth works, only when type is both and pattern
>not
> >>set
> >>(means don't provide the pattern attr)
> >>
> >>have u tried to override
> >>
> >>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
> >>
> >>?
> >>
> >>
> >>regarding "convertBothMessageDetail" we changed them during october 2006
> >>(tracked in Jira)
> >>
> >>-M
> >>
> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> >>>Hello Matthias,
> >>>
> >>>Thank you so much for responding.
> >>>
> >>>In the Trinidad documentation and demo source I have seen the attribute
> >>>messageDetailConvertBoth, but interestingly, it didn't seem to do
> >>>anything
> >>>for me ...
> >>>
> >>>However, convertBothMessageDetail (found in adf documentation) did
>work:
> >>>         <tr:inputText id="firstDate">
> >>>             <tr:convertDateTime type="both"
> >>>convertBothMessageDetail="Well,
> >>>the value ({1}) is not really in a propper format, like {2}"/>
> >>>         </tr:inputText>
> >>>
> >>>The problem is, that if I add the attribute pattern
>(pattern="MMM-dd-yyyy
> >>>HH:mm:ss") the custom message stops working.
> >>>
> >>>If you look at the trinidad api, they even specify in the description
>for
> >>>the attribute messageDetailConvertBoth:
> >>>"... when type is set to 'both' and pattern is not set or is null"
> >>>(http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_convertDateTime.html)
> >>>
> >>>Is there a way to have both pattern as well as customized messages?
> >>>
> >>>Thank you,
> >>>Magdolna
> >>>
> >>>
> >>>
> >>>
> >>> >From: "Matthias Wessendorf" <ma...@apache.org>
> >>> >Reply-To: adffaces-user@incubator.apache.org
> >>> >To: adffaces-user@incubator.apache.org
> >>> >Subject: Re: Custom messages for converters
> >>> >Date: Wed, 24 Jan 2007 09:50:32 +0100
> >>> >
> >>> >note that the type is by default "date"
> >>> >
> >>> >you need to do something like
> >>> >
> >>> ><tr:convertDateTime type="both" messageDetailConvertBoth="Well, the
> >>> >value ({1}) is not really in a propper format, like {2}"/>
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >On 1/24/07, Matthias Wessendorf <ma...@apache.org> wrote:
> >>> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> >>> >> > Hi all,
> >>> >> >
> >>> >> > I have been trying, unsuccessfully to customize the error
>messages
> >>> >>generated
> >>> >> > by a date/time converter (tr:convertDateTime).
> >>> >> >
> >>> >> > - I tried to add the message id to my resources file
> >>> >> >
> >>>(org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
> >>> >>
> >>> >>_detail
> >>> >>
> >>> >>
> >>> >> > - I tried to use the attribute convertBothMessageDetail
> >>> >>
> >>> >>attributes renamed to
> >>> >>
> >>> >>-messageDetailConvertBoth
> >>> >>-messageDetailConvertDate
> >>> >>-messageDetailConvertTime
> >>> >>
> >>> >>
> >>> >> > - I tried to create my own converter class by extending Trinidad
> >>> >>converter
> >>> >> > and use the setConvertBothMessageDetail method to set the custom
> >>> >>message
> >>> >> >
> >>> >> > It appears that it only works if I don't set the pattern.
> >>> >> > As soon as I am setting the pattern I get a default validation
>text
> >>> >>(The
> >>> >> > value "xxx" is not a valid date. Valid example: "Nov-29-2005
> >>> >>15:45:24".)
> >>> >> >
> >>> >> > Validator messages seem to be easily customizable, but not
> >>>converters.
> >>> >> > Could please someone point out what I am missing here?
> >>> >> >
> >>> >> > Thank you,
> >>> >> > Magdolna
> >>> >> >
> >>> >> > _________________________________________________________________
> >>> >> > Windows Live Spaces: share your New Year pictures!
> >>> >> > http://discoverspaces.live.com/?loc=en-CA
> >>> >> >
> >>> >> >
> >>> >>
> >>> >>
> >>> >>--
> >>> >>Matthias Wessendorf
> >>> >>http://tinyurl.com/fmywh
> >>> >>
> >>> >>further stuff:
> >>> >>blog: http://jroller.com/page/mwessendorf
> >>> >>mail: mwessendorf-at-gmail-dot-com
> >>> >>
> >>> >
> >>> >
> >>> >--
> >>> >Matthias Wessendorf
> >>> >http://tinyurl.com/fmywh
> >>> >
> >>> >further stuff:
> >>> >blog: http://jroller.com/page/mwessendorf
> >>> >mail: mwessendorf-at-gmail-dot-com
> >>>
> >>>_________________________________________________________________
> >>>Your Space. Your Friends. Your Stories. Share your world with Windows
> >>>Live
> >>>Spaces. http://discoverspaces.live.com/?loc=en-CA
> >>>
> >>>
> >>
> >>
> >>--
> >>Matthias Wessendorf
> >>http://tinyurl.com/fmywh
> >>
> >>further stuff:
> >>blog: http://jroller.com/page/mwessendorf
> >>mail: mwessendorf-at-gmail-dot-com
> >
> >_________________________________________________________________
> >Buy what you want when you want it on Sympatico / MSN Shopping
> >http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
> >
>
>_________________________________________________________________
>Free Alerts: Be smart - let your information find you!
>http://alerts.live.com/Alerts/Default.aspx
>
>


--
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

_________________________________________________________________
Buy what you want when you want it on Sympatico / MSN Shopping 
http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805




RE: Custom messages for converters

Posted by magdolna holitska <mh...@hotmail.com>.
Hi Anshuman,

You could just try something like:
<tr:inputText label="test" converter="myCustomDateTimeConverter"/>

As the message is set in the converter you could use if-else logic or 
something similar to set different messages. Note that you don't have to 
hard code the actual messages, you can still store them externally in a 
properties file - same for the pattern.

Regards,
Magdolna





>From: "Anshuman Abhishek Roy" <an...@in.ness.com>
>Reply-To: adffaces-user@incubator.apache.org
>To: <ad...@incubator.apache.org>
>Subject: RE: Custom messages for converters
>Date: Fri, 26 Jan 2007 19:54:05 +0530
>
Nice suggestion Matthias.

But then how do we configure this new datetime converter class in your faces 
application.

is it via using something like this:
<converter>

<converter-id>javax.faces.DateTime</converter-id>

<converter-class>test.converter.CustomDateTimeConverter</converter-class>

</converter>


in the faces-config.xml?

One more thing this will lead to the problem of what if I want to display 
different messages in different places for the same <tr:convertDatetime>?

Can it be done programatically by catching hold of the UIXComponent and then 
setXXX() methods on to the UIXComponent?

regards,
Anshuman

________________________________

From: mwessendorf@gmail.com on behalf of Matthias Wessendorf
Sent: Fri 1/26/2007 12:48 PM
To: adffaces-user@incubator.apache.org
Subject: Re: Custom messages for converters



well, at least you can create a custom converter, which isn't really to much 
:)

You also could extend the standard datetimeconverter and override the
getAsXxx and catch the exceptions, to throw your own.

-M

On 1/25/07, magdolna holitska <mh...@hotmail.com> wrote:
>Hi,
>
>I just would like to share my findings, after upgrading to the latest
>version of Trinidad:
>
>1. -- Overriding
>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH and
>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
>did not work
>
>2. -- messageDetailConvertBoth works, as long as you don's set the pattern
>As I understood this is intentional, to only allow customization of the
>message if the pattern is not set (I don't know why)
>
>3. -- for achieving both customize message and also set the pattern, I 
>ended
>up writing my own converter. It's really easy, I just extended
>javax.faces.convert.Converter and set the pattern and the error message to
>whatever I needed. I'm not sure if that's the best way to do it, but I
>didn't find a nicer way so far.
>
>Regards,
>Magdolna
>
>
>
>
>
>
> >From: "magdolna holitska" <mh...@hotmail.com>
> >Reply-To: adffaces-user@incubator.apache.org
> >To: adffaces-user@incubator.apache.org
> >Subject: Re: Custom messages for converters
> >Date: Wed, 24 Jan 2007 14:32:35 -0500
> >
> >Hi Matthias,
> >
> >Thank you for pointing that out to update to a newer version of Trinidad, 
>I
> >will follow your advice.
> >
> >Also, I tried to override CONVERT_BOTH_detail, but no luck yet.
> >I will try again after I switch to the new version.
> >
> >However, the description in the messageDetailConvertBoth attribute really
> >caught my eye:
> >"... if pattern is not set or is null".
> >To me this sounds like if the pattern is set and not null, the message
> >customization is ignored.
> >Just something I felt that I should point out.
> >
> >Thank you for all your help,
> >Magdolna
> >
> >
> >
> >
> >
> >>From: "Matthias Wessendorf" <ma...@apache.org>
> >>Reply-To: adffaces-user@incubator.apache.org
> >>To: adffaces-user@incubator.apache.org
> >>Subject: Re: Custom messages for converters
> >>Date: Wed, 24 Jan 2007 15:17:49 +0100
> >>
> >><tr:inputText label="test">
> >>  <tr:convertDateTime
> >>   type="both"
> >>   messageDetailConvertBoth="Well,the value ({1}) is not really in a
> >>propper format, like {2}"
> >>  />
> >></tr:inputText>
> >>
> >>works for me w/ latest trinidad (check the trunk)
> >>
> >>the messageDetailConvertBoth works, only when type is both and pattern 
>not
> >>set
> >>(means don't provide the pattern attr)
> >>
> >>have u tried to override
> >>
> >>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
> >>
> >>?
> >>
> >>
> >>regarding "convertBothMessageDetail" we changed them during october 2006
> >>(tracked in Jira)
> >>
> >>-M
> >>
> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> >>>Hello Matthias,
> >>>
> >>>Thank you so much for responding.
> >>>
> >>>In the Trinidad documentation and demo source I have seen the attribute
> >>>messageDetailConvertBoth, but interestingly, it didn't seem to do
> >>>anything
> >>>for me ...
> >>>
> >>>However, convertBothMessageDetail (found in adf documentation) did 
>work:
> >>>         <tr:inputText id="firstDate">
> >>>             <tr:convertDateTime type="both"
> >>>convertBothMessageDetail="Well,
> >>>the value ({1}) is not really in a propper format, like {2}"/>
> >>>         </tr:inputText>
> >>>
> >>>The problem is, that if I add the attribute pattern 
>(pattern="MMM-dd-yyyy
> >>>HH:mm:ss") the custom message stops working.
> >>>
> >>>If you look at the trinidad api, they even specify in the description 
>for
> >>>the attribute messageDetailConvertBoth:
> >>>"... when type is set to 'both' and pattern is not set or is null"
> >>>(http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_convertDateTime.html)
> >>>
> >>>Is there a way to have both pattern as well as customized messages?
> >>>
> >>>Thank you,
> >>>Magdolna
> >>>
> >>>
> >>>
> >>>
> >>> >From: "Matthias Wessendorf" <ma...@apache.org>
> >>> >Reply-To: adffaces-user@incubator.apache.org
> >>> >To: adffaces-user@incubator.apache.org
> >>> >Subject: Re: Custom messages for converters
> >>> >Date: Wed, 24 Jan 2007 09:50:32 +0100
> >>> >
> >>> >note that the type is by default "date"
> >>> >
> >>> >you need to do something like
> >>> >
> >>> ><tr:convertDateTime type="both" messageDetailConvertBoth="Well, the
> >>> >value ({1}) is not really in a propper format, like {2}"/>
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >On 1/24/07, Matthias Wessendorf <ma...@apache.org> wrote:
> >>> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> >>> >> > Hi all,
> >>> >> >
> >>> >> > I have been trying, unsuccessfully to customize the error 
>messages
> >>> >>generated
> >>> >> > by a date/time converter (tr:convertDateTime).
> >>> >> >
> >>> >> > - I tried to add the message id to my resources file
> >>> >> >
> >>>(org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
> >>> >>
> >>> >>_detail
> >>> >>
> >>> >>
> >>> >> > - I tried to use the attribute convertBothMessageDetail
> >>> >>
> >>> >>attributes renamed to
> >>> >>
> >>> >>-messageDetailConvertBoth
> >>> >>-messageDetailConvertDate
> >>> >>-messageDetailConvertTime
> >>> >>
> >>> >>
> >>> >> > - I tried to create my own converter class by extending Trinidad
> >>> >>converter
> >>> >> > and use the setConvertBothMessageDetail method to set the custom
> >>> >>message
> >>> >> >
> >>> >> > It appears that it only works if I don't set the pattern.
> >>> >> > As soon as I am setting the pattern I get a default validation 
>text
> >>> >>(The
> >>> >> > value "xxx" is not a valid date. Valid example: "Nov-29-2005
> >>> >>15:45:24".)
> >>> >> >
> >>> >> > Validator messages seem to be easily customizable, but not
> >>>converters.
> >>> >> > Could please someone point out what I am missing here?
> >>> >> >
> >>> >> > Thank you,
> >>> >> > Magdolna
> >>> >> >
> >>> >> > _________________________________________________________________
> >>> >> > Windows Live Spaces: share your New Year pictures!
> >>> >> > http://discoverspaces.live.com/?loc=en-CA
> >>> >> >
> >>> >> >
> >>> >>
> >>> >>
> >>> >>--
> >>> >>Matthias Wessendorf
> >>> >>http://tinyurl.com/fmywh
> >>> >>
> >>> >>further stuff:
> >>> >>blog: http://jroller.com/page/mwessendorf
> >>> >>mail: mwessendorf-at-gmail-dot-com
> >>> >>
> >>> >
> >>> >
> >>> >--
> >>> >Matthias Wessendorf
> >>> >http://tinyurl.com/fmywh
> >>> >
> >>> >further stuff:
> >>> >blog: http://jroller.com/page/mwessendorf
> >>> >mail: mwessendorf-at-gmail-dot-com
> >>>
> >>>_________________________________________________________________
> >>>Your Space. Your Friends. Your Stories. Share your world with Windows
> >>>Live
> >>>Spaces. http://discoverspaces.live.com/?loc=en-CA
> >>>
> >>>
> >>
> >>
> >>--
> >>Matthias Wessendorf
> >>http://tinyurl.com/fmywh
> >>
> >>further stuff:
> >>blog: http://jroller.com/page/mwessendorf
> >>mail: mwessendorf-at-gmail-dot-com
> >
> >_________________________________________________________________
> >Buy what you want when you want it on Sympatico / MSN Shopping
> >http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
> >
>
>_________________________________________________________________
>Free Alerts: Be smart - let your information find you!
>http://alerts.live.com/Alerts/Default.aspx
>
>


--
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

_________________________________________________________________
Buy what you want when you want it on Sympatico / MSN Shopping  
http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805


RE: Custom messages for converters

Posted by Anshuman Abhishek Roy <an...@in.ness.com>.
Nice suggestion Matthias.
 
But then how do we configure this new datetime converter class in your faces application. 
 
is it via using something like this:
<converter>

<converter-id>javax.faces.DateTime</converter-id>

<converter-class>test.converter.CustomDateTimeConverter</converter-class>

</converter>

 
in the faces-config.xml?
 
One more thing this will lead to the problem of what if I want to display different messages in different places for the same <tr:convertDatetime>?
 
Can it be done programatically by catching hold of the UIXComponent and then setXXX() methods on to the UIXComponent?
 
regards,
Anshuman

________________________________

From: mwessendorf@gmail.com on behalf of Matthias Wessendorf
Sent: Fri 1/26/2007 12:48 PM
To: adffaces-user@incubator.apache.org
Subject: Re: Custom messages for converters



well, at least you can create a custom converter, which isn't really to much :)

You also could extend the standard datetimeconverter and override the
getAsXxx and catch the exceptions, to throw your own.

-M

On 1/25/07, magdolna holitska <mh...@hotmail.com> wrote:
> Hi,
>
> I just would like to share my findings, after upgrading to the latest
> version of Trinidad:
>
> 1. -- Overriding
> org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH and
> org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
> did not work
>
> 2. -- messageDetailConvertBoth works, as long as you don's set the pattern
> As I understood this is intentional, to only allow customization of the
> message if the pattern is not set (I don't know why)
>
> 3. -- for achieving both customize message and also set the pattern, I ended
> up writing my own converter. It's really easy, I just extended
> javax.faces.convert.Converter and set the pattern and the error message to
> whatever I needed. I'm not sure if that's the best way to do it, but I
> didn't find a nicer way so far.
>
> Regards,
> Magdolna
>
>
>
>
>
>
> >From: "magdolna holitska" <mh...@hotmail.com>
> >Reply-To: adffaces-user@incubator.apache.org
> >To: adffaces-user@incubator.apache.org
> >Subject: Re: Custom messages for converters
> >Date: Wed, 24 Jan 2007 14:32:35 -0500
> >
> >Hi Matthias,
> >
> >Thank you for pointing that out to update to a newer version of Trinidad, I
> >will follow your advice.
> >
> >Also, I tried to override CONVERT_BOTH_detail, but no luck yet.
> >I will try again after I switch to the new version.
> >
> >However, the description in the messageDetailConvertBoth attribute really
> >caught my eye:
> >"... if pattern is not set or is null".
> >To me this sounds like if the pattern is set and not null, the message
> >customization is ignored.
> >Just something I felt that I should point out.
> >
> >Thank you for all your help,
> >Magdolna
> >
> >
> >
> >
> >
> >>From: "Matthias Wessendorf" <ma...@apache.org>
> >>Reply-To: adffaces-user@incubator.apache.org
> >>To: adffaces-user@incubator.apache.org
> >>Subject: Re: Custom messages for converters
> >>Date: Wed, 24 Jan 2007 15:17:49 +0100
> >>
> >><tr:inputText label="test">
> >>  <tr:convertDateTime
> >>   type="both"
> >>   messageDetailConvertBoth="Well,the value ({1}) is not really in a
> >>propper format, like {2}"
> >>  />
> >></tr:inputText>
> >>
> >>works for me w/ latest trinidad (check the trunk)
> >>
> >>the messageDetailConvertBoth works, only when type is both and pattern not
> >>set
> >>(means don't provide the pattern attr)
> >>
> >>have u tried to override
> >>
> >>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
> >>
> >>?
> >>
> >>
> >>regarding "convertBothMessageDetail" we changed them during october 2006
> >>(tracked in Jira)
> >>
> >>-M
> >>
> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> >>>Hello Matthias,
> >>>
> >>>Thank you so much for responding.
> >>>
> >>>In the Trinidad documentation and demo source I have seen the attribute
> >>>messageDetailConvertBoth, but interestingly, it didn't seem to do
> >>>anything
> >>>for me ...
> >>>
> >>>However, convertBothMessageDetail (found in adf documentation) did work:
> >>>         <tr:inputText id="firstDate">
> >>>             <tr:convertDateTime type="both"
> >>>convertBothMessageDetail="Well,
> >>>the value ({1}) is not really in a propper format, like {2}"/>
> >>>         </tr:inputText>
> >>>
> >>>The problem is, that if I add the attribute pattern (pattern="MMM-dd-yyyy
> >>>HH:mm:ss") the custom message stops working.
> >>>
> >>>If you look at the trinidad api, they even specify in the description for
> >>>the attribute messageDetailConvertBoth:
> >>>"... when type is set to 'both' and pattern is not set or is null"
> >>>(http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_convertDateTime.html)
> >>>
> >>>Is there a way to have both pattern as well as customized messages?
> >>>
> >>>Thank you,
> >>>Magdolna
> >>>
> >>>
> >>>
> >>>
> >>> >From: "Matthias Wessendorf" <ma...@apache.org>
> >>> >Reply-To: adffaces-user@incubator.apache.org
> >>> >To: adffaces-user@incubator.apache.org
> >>> >Subject: Re: Custom messages for converters
> >>> >Date: Wed, 24 Jan 2007 09:50:32 +0100
> >>> >
> >>> >note that the type is by default "date"
> >>> >
> >>> >you need to do something like
> >>> >
> >>> ><tr:convertDateTime type="both" messageDetailConvertBoth="Well, the
> >>> >value ({1}) is not really in a propper format, like {2}"/>
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >On 1/24/07, Matthias Wessendorf <ma...@apache.org> wrote:
> >>> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> >>> >> > Hi all,
> >>> >> >
> >>> >> > I have been trying, unsuccessfully to customize the error messages
> >>> >>generated
> >>> >> > by a date/time converter (tr:convertDateTime).
> >>> >> >
> >>> >> > - I tried to add the message id to my resources file
> >>> >> >
> >>>(org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
> >>> >>
> >>> >>_detail
> >>> >>
> >>> >>
> >>> >> > - I tried to use the attribute convertBothMessageDetail
> >>> >>
> >>> >>attributes renamed to
> >>> >>
> >>> >>-messageDetailConvertBoth
> >>> >>-messageDetailConvertDate
> >>> >>-messageDetailConvertTime
> >>> >>
> >>> >>
> >>> >> > - I tried to create my own converter class by extending Trinidad
> >>> >>converter
> >>> >> > and use the setConvertBothMessageDetail method to set the custom
> >>> >>message
> >>> >> >
> >>> >> > It appears that it only works if I don't set the pattern.
> >>> >> > As soon as I am setting the pattern I get a default validation text
> >>> >>(The
> >>> >> > value "xxx" is not a valid date. Valid example: "Nov-29-2005
> >>> >>15:45:24".)
> >>> >> >
> >>> >> > Validator messages seem to be easily customizable, but not
> >>>converters.
> >>> >> > Could please someone point out what I am missing here?
> >>> >> >
> >>> >> > Thank you,
> >>> >> > Magdolna
> >>> >> >
> >>> >> > _________________________________________________________________
> >>> >> > Windows Live Spaces: share your New Year pictures!
> >>> >> > http://discoverspaces.live.com/?loc=en-CA
> >>> >> >
> >>> >> >
> >>> >>
> >>> >>
> >>> >>--
> >>> >>Matthias Wessendorf
> >>> >>http://tinyurl.com/fmywh
> >>> >>
> >>> >>further stuff:
> >>> >>blog: http://jroller.com/page/mwessendorf
> >>> >>mail: mwessendorf-at-gmail-dot-com
> >>> >>
> >>> >
> >>> >
> >>> >--
> >>> >Matthias Wessendorf
> >>> >http://tinyurl.com/fmywh
> >>> >
> >>> >further stuff:
> >>> >blog: http://jroller.com/page/mwessendorf
> >>> >mail: mwessendorf-at-gmail-dot-com
> >>>
> >>>_________________________________________________________________
> >>>Your Space. Your Friends. Your Stories. Share your world with Windows
> >>>Live
> >>>Spaces. http://discoverspaces.live.com/?loc=en-CA
> >>>
> >>>
> >>
> >>
> >>--
> >>Matthias Wessendorf
> >>http://tinyurl.com/fmywh
> >>
> >>further stuff:
> >>blog: http://jroller.com/page/mwessendorf
> >>mail: mwessendorf-at-gmail-dot-com
> >
> >_________________________________________________________________
> >Buy what you want when you want it on Sympatico / MSN Shopping
> >http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
> >
>
> _________________________________________________________________
> Free Alerts: Be smart - let your information find you!
> http://alerts.live.com/Alerts/Default.aspx
>
>


--
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com



Re: Custom messages for converters

Posted by Matthias Wessendorf <ma...@apache.org>.
well, at least you can create a custom converter, which isn't really to much :)

You also could extend the standard datetimeconverter and override the
getAsXxx and catch the exceptions, to throw your own.

-M

On 1/25/07, magdolna holitska <mh...@hotmail.com> wrote:
> Hi,
>
> I just would like to share my findings, after upgrading to the latest
> version of Trinidad:
>
> 1. -- Overriding
> org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH and
> org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
> did not work
>
> 2. -- messageDetailConvertBoth works, as long as you don's set the pattern
> As I understood this is intentional, to only allow customization of the
> message if the pattern is not set (I don't know why)
>
> 3. -- for achieving both customize message and also set the pattern, I ended
> up writing my own converter. It's really easy, I just extended
> javax.faces.convert.Converter and set the pattern and the error message to
> whatever I needed. I'm not sure if that's the best way to do it, but I
> didn't find a nicer way so far.
>
> Regards,
> Magdolna
>
>
>
>
>
>
> >From: "magdolna holitska" <mh...@hotmail.com>
> >Reply-To: adffaces-user@incubator.apache.org
> >To: adffaces-user@incubator.apache.org
> >Subject: Re: Custom messages for converters
> >Date: Wed, 24 Jan 2007 14:32:35 -0500
> >
> >Hi Matthias,
> >
> >Thank you for pointing that out to update to a newer version of Trinidad, I
> >will follow your advice.
> >
> >Also, I tried to override CONVERT_BOTH_detail, but no luck yet.
> >I will try again after I switch to the new version.
> >
> >However, the description in the messageDetailConvertBoth attribute really
> >caught my eye:
> >"... if pattern is not set or is null".
> >To me this sounds like if the pattern is set and not null, the message
> >customization is ignored.
> >Just something I felt that I should point out.
> >
> >Thank you for all your help,
> >Magdolna
> >
> >
> >
> >
> >
> >>From: "Matthias Wessendorf" <ma...@apache.org>
> >>Reply-To: adffaces-user@incubator.apache.org
> >>To: adffaces-user@incubator.apache.org
> >>Subject: Re: Custom messages for converters
> >>Date: Wed, 24 Jan 2007 15:17:49 +0100
> >>
> >><tr:inputText label="test">
> >>  <tr:convertDateTime
> >>   type="both"
> >>   messageDetailConvertBoth="Well,the value ({1}) is not really in a
> >>propper format, like {2}"
> >>  />
> >></tr:inputText>
> >>
> >>works for me w/ latest trinidad (check the trunk)
> >>
> >>the messageDetailConvertBoth works, only when type is both and pattern not
> >>set
> >>(means don't provide the pattern attr)
> >>
> >>have u tried to override
> >>
> >>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
> >>
> >>?
> >>
> >>
> >>regarding "convertBothMessageDetail" we changed them during october 2006
> >>(tracked in Jira)
> >>
> >>-M
> >>
> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> >>>Hello Matthias,
> >>>
> >>>Thank you so much for responding.
> >>>
> >>>In the Trinidad documentation and demo source I have seen the attribute
> >>>messageDetailConvertBoth, but interestingly, it didn't seem to do
> >>>anything
> >>>for me ...
> >>>
> >>>However, convertBothMessageDetail (found in adf documentation) did work:
> >>>         <tr:inputText id="firstDate">
> >>>             <tr:convertDateTime type="both"
> >>>convertBothMessageDetail="Well,
> >>>the value ({1}) is not really in a propper format, like {2}"/>
> >>>         </tr:inputText>
> >>>
> >>>The problem is, that if I add the attribute pattern (pattern="MMM-dd-yyyy
> >>>HH:mm:ss") the custom message stops working.
> >>>
> >>>If you look at the trinidad api, they even specify in the description for
> >>>the attribute messageDetailConvertBoth:
> >>>"... when type is set to 'both' and pattern is not set or is null"
> >>>(http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_convertDateTime.html)
> >>>
> >>>Is there a way to have both pattern as well as customized messages?
> >>>
> >>>Thank you,
> >>>Magdolna
> >>>
> >>>
> >>>
> >>>
> >>> >From: "Matthias Wessendorf" <ma...@apache.org>
> >>> >Reply-To: adffaces-user@incubator.apache.org
> >>> >To: adffaces-user@incubator.apache.org
> >>> >Subject: Re: Custom messages for converters
> >>> >Date: Wed, 24 Jan 2007 09:50:32 +0100
> >>> >
> >>> >note that the type is by default "date"
> >>> >
> >>> >you need to do something like
> >>> >
> >>> ><tr:convertDateTime type="both" messageDetailConvertBoth="Well, the
> >>> >value ({1}) is not really in a propper format, like {2}"/>
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >On 1/24/07, Matthias Wessendorf <ma...@apache.org> wrote:
> >>> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> >>> >> > Hi all,
> >>> >> >
> >>> >> > I have been trying, unsuccessfully to customize the error messages
> >>> >>generated
> >>> >> > by a date/time converter (tr:convertDateTime).
> >>> >> >
> >>> >> > - I tried to add the message id to my resources file
> >>> >> >
> >>>(org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
> >>> >>
> >>> >>_detail
> >>> >>
> >>> >>
> >>> >> > - I tried to use the attribute convertBothMessageDetail
> >>> >>
> >>> >>attributes renamed to
> >>> >>
> >>> >>-messageDetailConvertBoth
> >>> >>-messageDetailConvertDate
> >>> >>-messageDetailConvertTime
> >>> >>
> >>> >>
> >>> >> > - I tried to create my own converter class by extending Trinidad
> >>> >>converter
> >>> >> > and use the setConvertBothMessageDetail method to set the custom
> >>> >>message
> >>> >> >
> >>> >> > It appears that it only works if I don't set the pattern.
> >>> >> > As soon as I am setting the pattern I get a default validation text
> >>> >>(The
> >>> >> > value "xxx" is not a valid date. Valid example: "Nov-29-2005
> >>> >>15:45:24".)
> >>> >> >
> >>> >> > Validator messages seem to be easily customizable, but not
> >>>converters.
> >>> >> > Could please someone point out what I am missing here?
> >>> >> >
> >>> >> > Thank you,
> >>> >> > Magdolna
> >>> >> >
> >>> >> > _________________________________________________________________
> >>> >> > Windows Live Spaces: share your New Year pictures!
> >>> >> > http://discoverspaces.live.com/?loc=en-CA
> >>> >> >
> >>> >> >
> >>> >>
> >>> >>
> >>> >>--
> >>> >>Matthias Wessendorf
> >>> >>http://tinyurl.com/fmywh
> >>> >>
> >>> >>further stuff:
> >>> >>blog: http://jroller.com/page/mwessendorf
> >>> >>mail: mwessendorf-at-gmail-dot-com
> >>> >>
> >>> >
> >>> >
> >>> >--
> >>> >Matthias Wessendorf
> >>> >http://tinyurl.com/fmywh
> >>> >
> >>> >further stuff:
> >>> >blog: http://jroller.com/page/mwessendorf
> >>> >mail: mwessendorf-at-gmail-dot-com
> >>>
> >>>_________________________________________________________________
> >>>Your Space. Your Friends. Your Stories. Share your world with Windows
> >>>Live
> >>>Spaces. http://discoverspaces.live.com/?loc=en-CA
> >>>
> >>>
> >>
> >>
> >>--
> >>Matthias Wessendorf
> >>http://tinyurl.com/fmywh
> >>
> >>further stuff:
> >>blog: http://jroller.com/page/mwessendorf
> >>mail: mwessendorf-at-gmail-dot-com
> >
> >_________________________________________________________________
> >Buy what you want when you want it on Sympatico / MSN Shopping
> >http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
> >
>
> _________________________________________________________________
> Free Alerts: Be smart - let your information find you!
> http://alerts.live.com/Alerts/Default.aspx
>
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: Error message customization in tr:datetime

Posted by magdolna holitska <mh...@hotmail.com>.
Hi Anshuman,
I raised the same a couple of days ago.
I recommend you to have a look at the messages having the title:
"Custom messages for converters"
I hope this helps,
Magdolna





>"Anshuman Abhishek Roy" <an...@in.ness.com>
>To: adffaces-user@incubator.apache.org
>Subject: Error message customization in <tr:datetime>
>Wed, 24 Jan 2007 13:36:00 GMT
>
Hi,

In the <tr:convertDateTime> if we put a pattern attribute and type 
=ttribute, then the my custom message in convertDateMessageDetail is not 
=howing up.

On further exploration of this component I found that the message can be 
=hown provided we remove the pattern attribute.

Is there any way of which we can let it show , but simulataneously =aintain 
its pattern.

I have attached the code below:
<tr:inputDate chooseId="entrydatepicker" id="entrydate"

value="#{BackingBean.startDate}"

onchange="closeCurrentPanelPopup();" >

<tr:convertDateTime id="xyz" pattern="MMM/d/yyyy" type="date"

convertDateMessageDetail="&quot;{0}&quot; in &quot;{1}&quot;  is an =nvalid 
date. Example: &quot;{2}&quot;"/>

</tr:inputDate>

regards,
Anshuman
________________________________

_________________________________________________________________
Buy, Load, Play. The new Sympatico / MSN Music Store works seamlessly with 
Windows Media Player. Just Click PLAY. 
http://musicstore.sympatico.msn.ca/content/viewer.aspx?cid=SMS_Sept192006


Re: Custom messages for converters

Posted by magdolna holitska <mh...@hotmail.com>.
Hi,

I just would like to share my findings, after upgrading to the latest 
version of Trinidad:

1. -- Overriding
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH and
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
did not work

2. -- messageDetailConvertBoth works, as long as you don's set the pattern
As I understood this is intentional, to only allow customization of the 
message if the pattern is not set (I don't know why)

3. -- for achieving both customize message and also set the pattern, I ended 
up writing my own converter. It's really easy, I just extended 
javax.faces.convert.Converter and set the pattern and the error message to 
whatever I needed. I'm not sure if that's the best way to do it, but I 
didn't find a nicer way so far.

Regards,
Magdolna






>From: "magdolna holitska" <mh...@hotmail.com>
>Reply-To: adffaces-user@incubator.apache.org
>To: adffaces-user@incubator.apache.org
>Subject: Re: Custom messages for converters
>Date: Wed, 24 Jan 2007 14:32:35 -0500
>
>Hi Matthias,
>
>Thank you for pointing that out to update to a newer version of Trinidad, I 
>will follow your advice.
>
>Also, I tried to override CONVERT_BOTH_detail, but no luck yet.
>I will try again after I switch to the new version.
>
>However, the description in the messageDetailConvertBoth attribute really 
>caught my eye:
>"... if pattern is not set or is null".
>To me this sounds like if the pattern is set and not null, the message 
>customization is ignored.
>Just something I felt that I should point out.
>
>Thank you for all your help,
>Magdolna
>
>
>
>
>
>>From: "Matthias Wessendorf" <ma...@apache.org>
>>Reply-To: adffaces-user@incubator.apache.org
>>To: adffaces-user@incubator.apache.org
>>Subject: Re: Custom messages for converters
>>Date: Wed, 24 Jan 2007 15:17:49 +0100
>>
>><tr:inputText label="test">
>>  <tr:convertDateTime
>>   type="both"
>>   messageDetailConvertBoth="Well,the value ({1}) is not really in a
>>propper format, like {2}"
>>  />
>></tr:inputText>
>>
>>works for me w/ latest trinidad (check the trunk)
>>
>>the messageDetailConvertBoth works, only when type is both and pattern not 
>>set
>>(means don't provide the pattern attr)
>>
>>have u tried to override
>>
>>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
>>
>>?
>>
>>
>>regarding "convertBothMessageDetail" we changed them during october 2006
>>(tracked in Jira)
>>
>>-M
>>
>>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
>>>Hello Matthias,
>>>
>>>Thank you so much for responding.
>>>
>>>In the Trinidad documentation and demo source I have seen the attribute
>>>messageDetailConvertBoth, but interestingly, it didn't seem to do 
>>>anything
>>>for me ...
>>>
>>>However, convertBothMessageDetail (found in adf documentation) did work:
>>>         <tr:inputText id="firstDate">
>>>             <tr:convertDateTime type="both" 
>>>convertBothMessageDetail="Well,
>>>the value ({1}) is not really in a propper format, like {2}"/>
>>>         </tr:inputText>
>>>
>>>The problem is, that if I add the attribute pattern (pattern="MMM-dd-yyyy
>>>HH:mm:ss") the custom message stops working.
>>>
>>>If you look at the trinidad api, they even specify in the description for
>>>the attribute messageDetailConvertBoth:
>>>"... when type is set to 'both' and pattern is not set or is null"
>>>(http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_convertDateTime.html)
>>>
>>>Is there a way to have both pattern as well as customized messages?
>>>
>>>Thank you,
>>>Magdolna
>>>
>>>
>>>
>>>
>>> >From: "Matthias Wessendorf" <ma...@apache.org>
>>> >Reply-To: adffaces-user@incubator.apache.org
>>> >To: adffaces-user@incubator.apache.org
>>> >Subject: Re: Custom messages for converters
>>> >Date: Wed, 24 Jan 2007 09:50:32 +0100
>>> >
>>> >note that the type is by default "date"
>>> >
>>> >you need to do something like
>>> >
>>> ><tr:convertDateTime type="both" messageDetailConvertBoth="Well, the
>>> >value ({1}) is not really in a propper format, like {2}"/>
>>> >
>>> >
>>> >
>>> >
>>> >On 1/24/07, Matthias Wessendorf <ma...@apache.org> wrote:
>>> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
>>> >> > Hi all,
>>> >> >
>>> >> > I have been trying, unsuccessfully to customize the error messages
>>> >>generated
>>> >> > by a date/time converter (tr:convertDateTime).
>>> >> >
>>> >> > - I tried to add the message id to my resources file
>>> >> > 
>>>(org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
>>> >>
>>> >>_detail
>>> >>
>>> >>
>>> >> > - I tried to use the attribute convertBothMessageDetail
>>> >>
>>> >>attributes renamed to
>>> >>
>>> >>-messageDetailConvertBoth
>>> >>-messageDetailConvertDate
>>> >>-messageDetailConvertTime
>>> >>
>>> >>
>>> >> > - I tried to create my own converter class by extending Trinidad
>>> >>converter
>>> >> > and use the setConvertBothMessageDetail method to set the custom
>>> >>message
>>> >> >
>>> >> > It appears that it only works if I don't set the pattern.
>>> >> > As soon as I am setting the pattern I get a default validation text
>>> >>(The
>>> >> > value "xxx" is not a valid date. Valid example: "Nov-29-2005
>>> >>15:45:24".)
>>> >> >
>>> >> > Validator messages seem to be easily customizable, but not 
>>>converters.
>>> >> > Could please someone point out what I am missing here?
>>> >> >
>>> >> > Thank you,
>>> >> > Magdolna
>>> >> >
>>> >> > _________________________________________________________________
>>> >> > Windows Live Spaces: share your New Year pictures!
>>> >> > http://discoverspaces.live.com/?loc=en-CA
>>> >> >
>>> >> >
>>> >>
>>> >>
>>> >>--
>>> >>Matthias Wessendorf
>>> >>http://tinyurl.com/fmywh
>>> >>
>>> >>further stuff:
>>> >>blog: http://jroller.com/page/mwessendorf
>>> >>mail: mwessendorf-at-gmail-dot-com
>>> >>
>>> >
>>> >
>>> >--
>>> >Matthias Wessendorf
>>> >http://tinyurl.com/fmywh
>>> >
>>> >further stuff:
>>> >blog: http://jroller.com/page/mwessendorf
>>> >mail: mwessendorf-at-gmail-dot-com
>>>
>>>_________________________________________________________________
>>>Your Space. Your Friends. Your Stories. Share your world with Windows 
>>>Live
>>>Spaces. http://discoverspaces.live.com/?loc=en-CA
>>>
>>>
>>
>>
>>--
>>Matthias Wessendorf
>>http://tinyurl.com/fmywh
>>
>>further stuff:
>>blog: http://jroller.com/page/mwessendorf
>>mail: mwessendorf-at-gmail-dot-com
>
>_________________________________________________________________
>Buy what you want when you want it on Sympatico / MSN Shopping 
>http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805
>

_________________________________________________________________
Free Alerts�: Be smart - let your information find you�! 
http://alerts.live.com/Alerts/Default.aspx


Re: Custom messages for converters

Posted by magdolna holitska <mh...@hotmail.com>.
Hi Matthias,

Thank you for pointing that out to update to a newer version of Trinidad, I 
will follow your advice.

Also, I tried to override CONVERT_BOTH_detail, but no luck yet.
I will try again after I switch to the new version.

However, the description in the messageDetailConvertBoth attribute really 
caught my eye:
"... if pattern is not set or is null".
To me this sounds like if the pattern is set and not null, the message 
customization is ignored.
Just something I felt that I should point out.

Thank you for all your help,
Magdolna





>From: "Matthias Wessendorf" <ma...@apache.org>
>Reply-To: adffaces-user@incubator.apache.org
>To: adffaces-user@incubator.apache.org
>Subject: Re: Custom messages for converters
>Date: Wed, 24 Jan 2007 15:17:49 +0100
>
><tr:inputText label="test">
>  <tr:convertDateTime
>   type="both"
>   messageDetailConvertBoth="Well,the value ({1}) is not really in a
>propper format, like {2}"
>  />
></tr:inputText>
>
>works for me w/ latest trinidad (check the trunk)
>
>the messageDetailConvertBoth works, only when type is both and pattern not 
>set
>(means don't provide the pattern attr)
>
>have u tried to override
>
>org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
>
>?
>
>
>regarding "convertBothMessageDetail" we changed them during october 2006
>(tracked in Jira)
>
>-M
>
>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
>>Hello Matthias,
>>
>>Thank you so much for responding.
>>
>>In the Trinidad documentation and demo source I have seen the attribute
>>messageDetailConvertBoth, but interestingly, it didn't seem to do anything
>>for me ...
>>
>>However, convertBothMessageDetail (found in adf documentation) did work:
>>         <tr:inputText id="firstDate">
>>             <tr:convertDateTime type="both" 
>>convertBothMessageDetail="Well,
>>the value ({1}) is not really in a propper format, like {2}"/>
>>         </tr:inputText>
>>
>>The problem is, that if I add the attribute pattern (pattern="MMM-dd-yyyy
>>HH:mm:ss") the custom message stops working.
>>
>>If you look at the trinidad api, they even specify in the description for
>>the attribute messageDetailConvertBoth:
>>"... when type is set to 'both' and pattern is not set or is null"
>>(http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_convertDateTime.html)
>>
>>Is there a way to have both pattern as well as customized messages?
>>
>>Thank you,
>>Magdolna
>>
>>
>>
>>
>> >From: "Matthias Wessendorf" <ma...@apache.org>
>> >Reply-To: adffaces-user@incubator.apache.org
>> >To: adffaces-user@incubator.apache.org
>> >Subject: Re: Custom messages for converters
>> >Date: Wed, 24 Jan 2007 09:50:32 +0100
>> >
>> >note that the type is by default "date"
>> >
>> >you need to do something like
>> >
>> ><tr:convertDateTime type="both" messageDetailConvertBoth="Well, the
>> >value ({1}) is not really in a propper format, like {2}"/>
>> >
>> >
>> >
>> >
>> >On 1/24/07, Matthias Wessendorf <ma...@apache.org> wrote:
>> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
>> >> > Hi all,
>> >> >
>> >> > I have been trying, unsuccessfully to customize the error messages
>> >>generated
>> >> > by a date/time converter (tr:convertDateTime).
>> >> >
>> >> > - I tried to add the message id to my resources file
>> >> > (org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
>> >>
>> >>_detail
>> >>
>> >>
>> >> > - I tried to use the attribute convertBothMessageDetail
>> >>
>> >>attributes renamed to
>> >>
>> >>-messageDetailConvertBoth
>> >>-messageDetailConvertDate
>> >>-messageDetailConvertTime
>> >>
>> >>
>> >> > - I tried to create my own converter class by extending Trinidad
>> >>converter
>> >> > and use the setConvertBothMessageDetail method to set the custom
>> >>message
>> >> >
>> >> > It appears that it only works if I don't set the pattern.
>> >> > As soon as I am setting the pattern I get a default validation text
>> >>(The
>> >> > value "xxx" is not a valid date. Valid example: "Nov-29-2005
>> >>15:45:24".)
>> >> >
>> >> > Validator messages seem to be easily customizable, but not 
>>converters.
>> >> > Could please someone point out what I am missing here?
>> >> >
>> >> > Thank you,
>> >> > Magdolna
>> >> >
>> >> > _________________________________________________________________
>> >> > Windows Live Spaces: share your New Year pictures!
>> >> > http://discoverspaces.live.com/?loc=en-CA
>> >> >
>> >> >
>> >>
>> >>
>> >>--
>> >>Matthias Wessendorf
>> >>http://tinyurl.com/fmywh
>> >>
>> >>further stuff:
>> >>blog: http://jroller.com/page/mwessendorf
>> >>mail: mwessendorf-at-gmail-dot-com
>> >>
>> >
>> >
>> >--
>> >Matthias Wessendorf
>> >http://tinyurl.com/fmywh
>> >
>> >further stuff:
>> >blog: http://jroller.com/page/mwessendorf
>> >mail: mwessendorf-at-gmail-dot-com
>>
>>_________________________________________________________________
>>Your Space. Your Friends. Your Stories. Share your world with Windows Live
>>Spaces. http://discoverspaces.live.com/?loc=en-CA
>>
>>
>
>
>--
>Matthias Wessendorf
>http://tinyurl.com/fmywh
>
>further stuff:
>blog: http://jroller.com/page/mwessendorf
>mail: mwessendorf-at-gmail-dot-com

_________________________________________________________________
Buy what you want when you want it on Sympatico / MSN Shopping 
http://shopping.sympatico.msn.ca/content/shp/?ctId=2,ptnrid=176,ptnrdata=081805


Re: Custom messages for converters

Posted by Matthias Wessendorf <ma...@apache.org>.
<tr:inputText label="test">
  <tr:convertDateTime
   type="both"
   messageDetailConvertBoth="Well,the value ({1}) is not really in a
propper format, like {2}"
  />
</tr:inputText>

works for me w/ latest trinidad (check the trunk)

the messageDetailConvertBoth works, only when type is both and pattern not set
(means don't provide the pattern attr)

have u tried to override

org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail

?


regarding "convertBothMessageDetail" we changed them during october 2006
(tracked in Jira)

-M

On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> Hello Matthias,
>
> Thank you so much for responding.
>
> In the Trinidad documentation and demo source I have seen the attribute
> messageDetailConvertBoth, but interestingly, it didn't seem to do anything
> for me ...
>
> However, convertBothMessageDetail (found in adf documentation) did work:
>         <tr:inputText id="firstDate">
>             <tr:convertDateTime type="both" convertBothMessageDetail="Well,
> the value ({1}) is not really in a propper format, like {2}"/>
>         </tr:inputText>
>
> The problem is, that if I add the attribute pattern (pattern="MMM-dd-yyyy
> HH:mm:ss") the custom message stops working.
>
> If you look at the trinidad api, they even specify in the description for
> the attribute messageDetailConvertBoth:
> "... when type is set to 'both' and pattern is not set or is null"
> (http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_convertDateTime.html)
>
> Is there a way to have both pattern as well as customized messages?
>
> Thank you,
> Magdolna
>
>
>
>
> >From: "Matthias Wessendorf" <ma...@apache.org>
> >Reply-To: adffaces-user@incubator.apache.org
> >To: adffaces-user@incubator.apache.org
> >Subject: Re: Custom messages for converters
> >Date: Wed, 24 Jan 2007 09:50:32 +0100
> >
> >note that the type is by default "date"
> >
> >you need to do something like
> >
> ><tr:convertDateTime type="both" messageDetailConvertBoth="Well, the
> >value ({1}) is not really in a propper format, like {2}"/>
> >
> >
> >
> >
> >On 1/24/07, Matthias Wessendorf <ma...@apache.org> wrote:
> >>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> >> > Hi all,
> >> >
> >> > I have been trying, unsuccessfully to customize the error messages
> >>generated
> >> > by a date/time converter (tr:convertDateTime).
> >> >
> >> > - I tried to add the message id to my resources file
> >> > (org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
> >>
> >>_detail
> >>
> >>
> >> > - I tried to use the attribute convertBothMessageDetail
> >>
> >>attributes renamed to
> >>
> >>-messageDetailConvertBoth
> >>-messageDetailConvertDate
> >>-messageDetailConvertTime
> >>
> >>
> >> > - I tried to create my own converter class by extending Trinidad
> >>converter
> >> > and use the setConvertBothMessageDetail method to set the custom
> >>message
> >> >
> >> > It appears that it only works if I don't set the pattern.
> >> > As soon as I am setting the pattern I get a default validation text
> >>(The
> >> > value "xxx" is not a valid date. Valid example: "Nov-29-2005
> >>15:45:24".)
> >> >
> >> > Validator messages seem to be easily customizable, but not converters.
> >> > Could please someone point out what I am missing here?
> >> >
> >> > Thank you,
> >> > Magdolna
> >> >
> >> > _________________________________________________________________
> >> > Windows Live Spaces: share your New Year pictures!
> >> > http://discoverspaces.live.com/?loc=en-CA
> >> >
> >> >
> >>
> >>
> >>--
> >>Matthias Wessendorf
> >>http://tinyurl.com/fmywh
> >>
> >>further stuff:
> >>blog: http://jroller.com/page/mwessendorf
> >>mail: mwessendorf-at-gmail-dot-com
> >>
> >
> >
> >--
> >Matthias Wessendorf
> >http://tinyurl.com/fmywh
> >
> >further stuff:
> >blog: http://jroller.com/page/mwessendorf
> >mail: mwessendorf-at-gmail-dot-com
>
> _________________________________________________________________
> Your Space. Your Friends. Your Stories. Share your world with Windows Live
> Spaces. http://discoverspaces.live.com/?loc=en-CA
>
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: Custom messages for converters

Posted by magdolna holitska <mh...@hotmail.com>.
Hello Matthias,

Thank you so much for responding.

In the Trinidad documentation and demo source I have seen the attribute 
messageDetailConvertBoth, but interestingly, it didn't seem to do anything 
for me ...

However, convertBothMessageDetail (found in adf documentation) did work:
        <tr:inputText id="firstDate">
            <tr:convertDateTime type="both" convertBothMessageDetail="Well, 
the value ({1}) is not really in a propper format, like {2}"/>
        </tr:inputText>

The problem is, that if I add the attribute pattern (pattern="MMM-dd-yyyy 
HH:mm:ss") the custom message stops working.

If you look at the trinidad api, they even specify in the description for 
the attribute messageDetailConvertBoth:
"... when type is set to 'both' and pattern is not set or is null"
(http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_convertDateTime.html)

Is there a way to have both pattern as well as customized messages?

Thank you,
Magdolna




>From: "Matthias Wessendorf" <ma...@apache.org>
>Reply-To: adffaces-user@incubator.apache.org
>To: adffaces-user@incubator.apache.org
>Subject: Re: Custom messages for converters
>Date: Wed, 24 Jan 2007 09:50:32 +0100
>
>note that the type is by default "date"
>
>you need to do something like
>
><tr:convertDateTime type="both" messageDetailConvertBoth="Well, the
>value ({1}) is not really in a propper format, like {2}"/>
>
>
>
>
>On 1/24/07, Matthias Wessendorf <ma...@apache.org> wrote:
>>On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
>> > Hi all,
>> >
>> > I have been trying, unsuccessfully to customize the error messages 
>>generated
>> > by a date/time converter (tr:convertDateTime).
>> >
>> > - I tried to add the message id to my resources file
>> > (org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
>>
>>_detail
>>
>>
>> > - I tried to use the attribute convertBothMessageDetail
>>
>>attributes renamed to
>>
>>-messageDetailConvertBoth
>>-messageDetailConvertDate
>>-messageDetailConvertTime
>>
>>
>> > - I tried to create my own converter class by extending Trinidad 
>>converter
>> > and use the setConvertBothMessageDetail method to set the custom 
>>message
>> >
>> > It appears that it only works if I don't set the pattern.
>> > As soon as I am setting the pattern I get a default validation text 
>>(The
>> > value "xxx" is not a valid date. Valid example: "Nov-29-2005 
>>15:45:24".)
>> >
>> > Validator messages seem to be easily customizable, but not converters.
>> > Could please someone point out what I am missing here?
>> >
>> > Thank you,
>> > Magdolna
>> >
>> > _________________________________________________________________
>> > Windows Live Spaces: share your New Year pictures!
>> > http://discoverspaces.live.com/?loc=en-CA
>> >
>> >
>>
>>
>>--
>>Matthias Wessendorf
>>http://tinyurl.com/fmywh
>>
>>further stuff:
>>blog: http://jroller.com/page/mwessendorf
>>mail: mwessendorf-at-gmail-dot-com
>>
>
>
>--
>Matthias Wessendorf
>http://tinyurl.com/fmywh
>
>further stuff:
>blog: http://jroller.com/page/mwessendorf
>mail: mwessendorf-at-gmail-dot-com

_________________________________________________________________
Your Space. Your Friends. Your Stories. Share your world with Windows Live 
Spaces. http://discoverspaces.live.com/?loc=en-CA


Re: Custom messages for converters

Posted by Matthias Wessendorf <ma...@apache.org>.
note that the type is by default "date"

you need to do something like

<tr:convertDateTime type="both" messageDetailConvertBoth="Well, the
value ({1}) is not really in a propper format, like {2}"/>




On 1/24/07, Matthias Wessendorf <ma...@apache.org> wrote:
> On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> > Hi all,
> >
> > I have been trying, unsuccessfully to customize the error messages generated
> > by a date/time converter (tr:convertDateTime).
> >
> > - I tried to add the message id to my resources file
> > (org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)
>
> _detail
>
>
> > - I tried to use the attribute convertBothMessageDetail
>
> attributes renamed to
>
> -messageDetailConvertBoth
> -messageDetailConvertDate
> -messageDetailConvertTime
>
>
> > - I tried to create my own converter class by extending Trinidad converter
> > and use the setConvertBothMessageDetail method to set the custom message
> >
> > It appears that it only works if I don't set the pattern.
> > As soon as I am setting the pattern I get a default validation text (The
> > value "xxx" is not a valid date. Valid example: "Nov-29-2005 15:45:24".)
> >
> > Validator messages seem to be easily customizable, but not converters.
> > Could please someone point out what I am missing here?
> >
> > Thank you,
> > Magdolna
> >
> > _________________________________________________________________
> > Windows Live Spaces: share your New Year pictures!
> > http://discoverspaces.live.com/?loc=en-CA
> >
> >
>
>
> --
> Matthias Wessendorf
> http://tinyurl.com/fmywh
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: Custom messages for converters

Posted by Matthias Wessendorf <ma...@apache.org>.
On 1/24/07, magdolna holitska <mh...@hotmail.com> wrote:
> Hi all,
>
> I have been trying, unsuccessfully to customize the error messages generated
> by a date/time converter (tr:convertDateTime).
>
> - I tried to add the message id to my resources file
> (org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH)

_detail


> - I tried to use the attribute convertBothMessageDetail

attributes renamed to

-messageDetailConvertBoth
-messageDetailConvertDate
-messageDetailConvertTime


> - I tried to create my own converter class by extending Trinidad converter
> and use the setConvertBothMessageDetail method to set the custom message
>
> It appears that it only works if I don't set the pattern.
> As soon as I am setting the pattern I get a default validation text (The
> value "xxx" is not a valid date. Valid example: "Nov-29-2005 15:45:24".)
>
> Validator messages seem to be easily customizable, but not converters.
> Could please someone point out what I am missing here?
>
> Thank you,
> Magdolna
>
> _________________________________________________________________
> Windows Live Spaces: share your New Year pictures!
> http://discoverspaces.live.com/?loc=en-CA
>
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com