you can register your own converter in the settings, or override
getconverter on the textfield.
-igor
On 5/18/07, Dragos Bobes <[EMAIL PROTECTED]> wrote:
After investigating a little I discovered that my problem is coming from
org.apache.wicket.datetime.DateConverter class that converts an empty
string to current date.
Is there a way to change the DateField's behaviour so I get a null date
whenever there is not user input in that field?
Thanks,
Dragos
Dragos Bobes wrote:
> I have a form with a not required date field. The problem is that when
> the form is submitted and no value was selected in the date field, the
> date field is initialized to current date.
> Is this an intended behaviour and if yes how can I avoid it.
> I pasted an example code bellow.
>
> Thanks
> Dragos
>
> import java.util.Date;
>
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.form.Button;
> import org.apache.wicket.markup.html.form.Form;
> import org.apache.wicket.model.CompoundPropertyModel;
> import org.apache.wicket.extensions.yui.calendar.DateField;
>
> public class DateTest extends WebPage {
>
> private Date _date;
>
> public DateTest() {
> Form form = new Form("myForm", new CompoundPropertyModel(this));
> add(form);
> form.add(new DateField("date"));
> form.add(new Button("btn"));
> }
>
> public Date getDate() {
> System.out.println("get date " + _date);
> return _date;
> }
>
> public void setDate(Date date) {
> System.out.println("set date " + date);
> _date = date;
> }
> }
>
>
> <form wicket:id="myForm">
> <span wicket:id="date" ></span>
> <input type="submit" wicket:id="btn" />
> </form>
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user