On Mon, Jun 1, 2015 at 3:39 PM, Urbani, Edmund <edmund.urb...@lilandit.com> wrote:
> Ah, of course: wicket-datetime. > > Thanks, I'll try that - though I was hoping I would not to have to work > directly with its sub-components. > > And more out of curiosity: > Will there be a neater way to do this in Wicket 7 (or perhaps 8)? Right > now AJAX behaviors that can be applied to FormComponentPanels seem like a > good idea to me. ;) > No, there is nothing about this in Wicket 7.x. I don't think there will be something in 8.x too. We are not big fans of auto-magical functionalities. We prefer to give you the facilities (like the factory methods, visitors, etc.) and let you define your application logic. What I'd do for your use case is to extend OnChangeAjaxBehavior, override its #updateRequestAttributes() with attributes.setChildSelector("input, select, textarea") and attributes.getDynamicExtraParameters("return collectChildrenFormElementsValues(attrs.c)") and then in onChange() read the submitted values and update the form components. But you will need Wicket 6.x for all this... > > Kind regards, > Edmund > > > On 06/01/2015 02:18 PM, Martin Grigorov wrote: > > Hi, > > I guess you talk about [1]. It is in wicket-datetime, not > wicket-extensions. > > It is a Panel component, actually FormComponentPanel, so > adding OnChangeAjaxBehavior to it won't work. > I am not sure why the hour and time sub-components work for you. I'd > expect that you add OnChangeAjaxBehavior to each TextField inside it. > In Wicket 6.x there are factory methods for all sub components. In 1.5.x I > see there is only #newDateTextField() [2]. > You can use DateTimeField.get("...") to get a reference to a child > component and add the behavior to it. > > 1. > https://github.com/apache/wicket/blob/wicket-1.5.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DateTimeField.java > 2. > https://github.com/apache/wicket/blob/wicket-1.5.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DateTimeField.java#L411 > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Mon, Jun 1, 2015 at 3:05 PM, Urbani, Edmund <edmund.urb...@lilandit.com > > wrote: > >> Hello all, I am having trouble trying to apply an OnChangeAjaxBehaviour >> to the DateTimeField component from wicket-extensions. The AJAX updates >> always cause the model to be set to null. Even when the model is >> initialized with a non-null value, and that date is property displayed, any >> attempt to edit it will again set the model value back to null. Editing the >> date part does not seem to cause an AJAX update at all, only the time >> fields do. The project I am working on is currently using Wicket 1.5.13. >> Any ideas? Kind reagards, Edmund >> >> >> >> >> >> >> >> >> >> >> -- >> >> Edmund Urbani >> Liland IT Team Email: edmund.urb...@lilandit.com >> <edmund.urb...@lilandit.com> >> >> Liland IT GmbH ...does IT better >> Tel: +43 463 220111 <%2B43%20463%20220111> >> Fax: +43 463 220111-33 >> Tel(GER): +49 221 65028588 <%2B49%20221%2065028588> >> >> Find us at Facebook http://facebook.com/Lilandit >> http://green-badges.com >> http://iventcloud.com >> http://Lilandit.com >> >> <http://www.LilandIT.com> <http://www.LilandIT.com> >> >> Copyright © 2015 Liland IT GmbH This mail may contain confidential and / >> or privileged information. If you are not the intended recipient or have >> received this email in error, please notify the sender immediately and >> destroy this email. The unauthorized copying and unauthorized >> distribution of this mail is strictly forbidden. This email may contain >> confidential and / or privileged information. If you are not the >> Intended Recipient (or have received this email in error) please notify the >> sender immediately and destroy this email. Any Unauthorised copying, >> disclosure or distribution of the material in this email is strictly >> forbidden. >> >> >> >> >> >> > > > -- > > Mit freundlichen Grüßen > Edmund Urbani > Liland IT Team > > Email: edmund.urb...@lilandit.com <edmund.urb...@lilandit.com> > > Liland IT GmbH ...does IT better > Tel: +43 463 220111 > Fax: +43 463 220111-33 > Tel(GER): +49 221 65028588 > > Find us at Facebook http://facebook.com/Lilandit > http://green-badges.com > http://iventcloud.com > http://Lilandit.com > > <http://www.LilandIT.com> <http://www.LilandIT.com> > > Copyright © 2015, Liland IT GmbH > > Diese Mail enthaelt vertrauliche und/oder rechtlich geschuetzte > Informationen. > Wenn Sie nicht der richtige Adressat sind oder diese Email irrtuemlich > erhalten haben, informieren Sie bitte sofort den Absender und vernichten > Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe > dieser Mail ist nicht gestattet. > > This email may contain confidential and/or privileged information. > If you are not the intended recipient (or have received this email in > error) please notify the sender immediately and destroy this email. Any > unauthorised copying, disclosure or distribution of the material in this > email is strictly forbidden. >