Error while parsing datetime when using AjaxFormComponentBehavior with DateTimePicker

40 views
Skip to first unread message

Václav Čermák

unread,
Jul 9, 2015, 7:13:52 AM7/9/15
to wicket-j...@googlegroups.com
Hi,

I'am facing another problem with DateTimePicker. I attached AjaxFormComponentBehavior on it:

import com.googlecode.wicket.kendo.ui.form.datetime.DateTimePicker;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;

public class HomePage extends WebPage {
   
private static final long serialVersionUID = 1L;

   
private WebMarkupContainer dtp;
   
   
public HomePage(final PageParameters parameters) {
       
super(parameters);

        add
(new Label("version", getApplication().getFrameworkSettings().getVersion()));

        add
(dtp = new DateTimePicker("dtp"));
        dtp
.setOutputMarkupId(true);
        dtp
.add(new AjaxFormComponentUpdatingBehavior("onchange")
       
{
           
           
@Override
           
protected void onUpdate(AjaxRequestTarget target)
           
{
               
System.out.println("CHANGED!");
           
}
       
});
       
   
}
   
}

and I'am getting an error:

Value of variable [[date]] could not be resolved while interpolating [[Error while parsing datetime: date was '${date}' and time was '${time}']]

when I try to change a date in browser. This error I'am getting from attached quickstart as well ...


kendoui.datetimepicker-test.zip

Martin Grigorov

unread,
Jul 9, 2015, 7:25:51 AM7/9/15
to wicket-j...@googlegroups.com, us...@wicket.apache.org
Hi,

This may be a limitation of Wicket itself.

DateTimePicker is a FormComponentPanel, i.e. it is not attached to HTML form element but most probably to a <div> that has some HTML form elements inside it.
I am not 100% sure but AFAIR wicket-ajax.js doesn't traverse the children of the <div>. It just tries to get the 'value' of the form component with wicket:id on it, in this case the <div>, so it will send 'null' as a value.
Once this is improved I think we will need to improve the server side as well. As you can see at [1] it updates only the formComponent's model, but not the models of its children in case of FormComponentPanel.

I'll be able to run the application later today or tomorrow to confirm this.

Please file a ticket for improvement at Wicket JIRA.
Thanks!


--
You received this message because you are subscribed to the Google Groups "wicket-jquery-ui" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wicket-jquery-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wicket-jquery-ui/edc29b75-17b9-4181-bb15-21e630af905f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sebastien

unread,
Jul 9, 2015, 7:38:21 AM7/9/15
to wicket-j...@googlegroups.com
Hi,

Why don't you use AjaxDateTimePicker instead?

Best regards,
Sebastien.

Václav Čermák

unread,
Jul 9, 2015, 9:20:11 AM7/9/15
to wicket-j...@googlegroups.com, us...@wicket.apache.org
I created this issue:

https://issues.apache.org/jira/browse/WICKET-5948

I think, that you are right, I lurked into a code with debugger a bit and it fails on null values of date and time inputs forming whole datetime input.


Dne čtvrtek 9. července 2015 13:25:51 UTC+2 Martin Grigorov napsal(a):

Václav Čermák

unread,
Jul 9, 2015, 9:21:54 AM7/9/15
to wicket-j...@googlegroups.com

Its probably another my "reinventing the wheel" case ... AjaxDateTimePicker works like charm, of course ... Thank you!

Dne čtvrtek 9. července 2015 13:38:21 UTC+2 Sebastien Briquet napsal(a):

Sebastien

unread,
Jul 9, 2015, 9:26:55 AM7/9/15
to wicket-j...@googlegroups.com
You are welcome.

Pay attention, in your quickstart you have referenced

        <dependency>
            <groupId>com.googlecode.wicket-jquery-ui</groupId>
            <artifactId>jquery-ui-kendo</artifactId>
            <version>6.2.2</version>
        </dependency>


which is not needed!

Best regards,
Sebastien.
Reply all
Reply to author
Forward
0 new messages