James, thanks for your reply, this has put me on the right track.
I have now augmented the DateSelector a bit, so that it can be easily used for getting the submitted date/calendar back. Also, it handles Locales automatically now, based on either the information in RunData if you use the new DateSelector(myName, myCalendar, runData) ctor, or if you call ds.setLocale(myLocale). This behaviour can be suppressed by calling ds.setUseLocale(false). (Or simply leaving the new ctor and setLocale() alone). If you are interested, the patch is available in the turbine-dev archives: http://nagoya.apache.org:8080/eyebrowse/ReadMsg?[EMAIL PROTECTED]&msgNo=4424 Cheers, Ben James Cooper wrote: > Hi Ben, > Well it is one of the most trivial things, but in the end it was kinda > labourious. Heres a quick and dirty way I implemented it, it you come up or > anyone else comes up with something a little cleaner by all means join the > discussion. > > I basically sent the DateSelector object to the screen, had problems > localising it to a European date format Day/Month/Year > > Putting it to the screen with the current date: > ElementContainer dateSelect = new ElementContainer(); > Calendar calendar = new GregorianCalendar(); > > Date myStartDate = new Date(); > calendar.setTime(myStartDate); > Locale myLocale = new Locale("ENGLISH", "UK"); > calendar = calendar.getInstance(myLocale); > > DateSelector ds = new DateSelector("fromDate", calendar); > dateSelect = ds.ecsOutput(); > > I then grab the resulting generating code using the: > String lmnthStartDate = data.getParameters().getString("fromDate_month"); > String ldayStartDate = data.getParameters().getString("fromDate_day"); > String lyearStartDate = data.getParameters().getString("fromDate_year"); > > Then I form a string and convert this into a date: > ParsePosition pos = new ParsePosition(0); > String lStrDate = ldayStartDate+"/"+strMnthStartDate+"/"+lyearStartDate; > > Date myStartDate = formatter.parse(lStrDate, pos); > > > This is a little rough and very much a cut n paste effort. But I'm sure you > get my drift...if you come across with anything better let me know. > > > -----Original Message----- > From: Ben Peter [mailto:[EMAIL PROTECTED]] > Sent: 12 April 2002 09:03 > To: [EMAIL PROTECTED] > Subject: Examples of hadling date input > > > Hi, > > browsing through the turbine2 and fulcrum java docs I have found two things > that provide help with handling date input: > > http://jakarta.apache.org/turbine/turbine-2/apidocs/org/apache/turbine/util/ > DateSelector.html > http://jakarta.apache.org/turbine/fulcrum/apidocs/org/apache/fulcrum/intake/ > model/DateStringField.html > > Has anyone used intake and/or the DateSelector and can provide a simple > example > of how to use them? > > If no and there is interest, I will investigate and post it back here. > > (I realise that this is probably nothing very sophisticated, but I always > find > it a tedious task to figure out how date input is best handled). > > Cheers, > Ben > > -- > Benjamin Peter +49-69-96244395 > Application Engineer Moerfelder Landstr. 55 > (zentropy:partners) 60598 Frankfurt, Germany > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- Benjamin Peter +49-69-96244395 Application Engineer Moerfelder Landstr. 55 (zentropy:partners) 60598 Frankfurt, Germany -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
