How can we display by example the format to be used to input Date in DateTextField ?
I use a DateTextField to check if a user encode date according to the Date pattern format defined. DateTextField textfieldFromDate = new DateTextField(fromDate, MMdd ); Question 1 : Is it possible in the message displayed by Wicket after the validation in the feedbackPanel to show the correct format to be used ? Question 2 . Can we define the format to be used (in the case of a date) as setLenient() to verify if the date encoded is correct unlike as the following date 20090230 ? Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer * blog : http://cmoulliard.blogspot.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How can we display by example the format to be used to input Date in DateTextField ?
about question 1, yes: http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/util/convert/ConversionException.html#setResourceKey%28java.lang.String%29 On Mon, Sep 28, 2009 at 10:57 AM, Charles Moulliard cmoulli...@gmail.comwrote: I use a DateTextField to check if a user encode date according to the Date pattern format defined. DateTextField textfieldFromDate = new DateTextField(fromDate, MMdd ); Question 1 : Is it possible in the message displayed by Wicket after the validation in the feedbackPanel to show the correct format to be used ? Question 2 . Can we define the format to be used (in the case of a date) as setLenient() to verify if the date encoded is correct unlike as the following date 20090230 ? Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer * blog : http://cmoulliard.blogspot.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
Re: How can we display by example the format to be used to input Date in DateTextField ?
Hi Charles About Question 1: The validation message seems to have its origin in FormComponent#convertInput(): It will try either IConverter.date class simple name or IConverter and the used pattern will be available as the variable format (or ${format} as used in the string resources). About Question 2: You'll have to subclass the DateTextField and override getConverter(). You could then just check if the returned super.getConverter() is of type DateConverter and if yes, call the setLenient() method on it. Matt Charles Moulliard wrote: I use a DateTextField to check if a user encode date according to the Date pattern format defined. DateTextField textfieldFromDate = new DateTextField(fromDate, MMdd ); Question 1 : Is it possible in the message displayed by Wicket after the validation in the feedbackPanel to show the correct format to be used ? Question 2 . Can we define the format to be used (in the case of a date) as setLenient() to verify if the date encoded is correct unlike as the following date 20090230 ? Regards, Charles Moulliard smime.p7s Description: S/MIME Cryptographic Signature