Erik,

I had similar issues with the DatePicker for various reasons.  After some help from Nick and Igor I built a 3 dropdown component for choosing date similar to what you describe below.  Check out my blog entry for details on it:


basically you want to create a DateModel which holds a Date object passed in to your component and override getObject to return the appropriate value based on the field you want, MONTH, DAY_OF_MONTH, YEAR.

override setObject to set each field in a Calendar object so that when the form submits, all fields in a Calendar are set one-by-one, and can return a valid date.  The Model's are nice because all you have to do is pass in a Date, and the rest is done.

If you search in the feature enhancements on wicket's sf.net page, I believe I submitted the code there.

validation would probably be easiest just to use some client-side _javascript_.

Cheers,

andrew

On Sep 7, 2006, at 2:29 AM, Erik Brakkee wrote:

Hi,


I have tried to use the DatePicker component but somehow it doesn't
really work on Firefox 1.5 on linux. For instance, it only shows the
even years, and has strange behavior resetting fields.

Therefore, I want to write my own date component. Very simple, three
drop down choices for year, month, and day of month respectively. I am
now using a Panel component for this. The problem is here that the state
of my DateChooser is represented by three String fields for year, month,
and day of month, whereas my model is represented as a java.util.Date in
the IModel (PropertyModel).

Now, when I make sure that my DropDownChoice implementation has
wantOnSelectionChangedNotification() returning true, I get notified of
every change and in this callback I can set the model to the appropriate
date by using the three String field values as input. Problem is that if
the user doesn't change the date, then no date will be set. Furthermore,
a server round-trip is not necessary so I would like to get rid of this.

I would like to avoid server round trips, make sure the model is set on
submit of the form, and also I would like to use validation of the date
(the day of month could be out of range).  How would I solve this problem?

Cheers
  Erik

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
_______________________________________________
Wicket-user mailing list


To our success!

meAndrew Lombardi: Mystic Coders, LLC - Coding Magic
contact | [EMAIL PROTECTED] - 714-697-8046 | aim - nlpjunke


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to