I don't see any problem. Put a break point in AjaxRequestTarget.addComponent() and see what is registered. If you see component with id "hours" then investigate the stacktrace. As last resort you can create a quickstart with plain Wicket components and if it still fails with this error send it to us in a ticket.
On Thu, Jul 21, 2011 at 11:49 PM, Julian Sinai <jsi...@gmail.com> wrote: > Hi Martin > Thanks for looking at this. It's a bit complicated because we've built a > form framework around Wicket, but here goes: > In the page: > HtFormPanel.DateFormField startField = new > HtFormPanel.DateFormField("startField", > new StringResourceModel("start", this, null), new PropertyModel<Date>(this, > "start"), false); > Where the constructor for HtFormPanel.DateFormField is: > public DateFormField(String uniqueId, IModel<String> label, IModel m, > boolean bShowTime) > { > // The DateTimeField is contained within the DateFormField > super(uniqueId, FieldType.DATETEXTFIELD.toString(), > (bShowTime ? new DateTimeField(FIELD_ID) : > new DateField(FIELD_ID)), label, m); > } > Next, in the page: > startField.setFieldOutputMarkupId(true); > // The radio button that does the ajax update: > final HtFormPanel.RadioFormField<ReportAction> actionField = new > HtFormPanel.RadioFormField<ReportAction>( > "actionField",new ResourceModel("actionField"),actionTypes,new > LocalizedChoiceRenderer<ReportAction>(this), > new PropertyModel<ReportAction>(this,"action")); > Finally, the update code that causes the problem: > actionField.getFormComponent().add( > new HtAjaxFormChoiceComponentUpdatingBehavior() { > private static final long serialVersionUID = 8574977146235850631L; > protected void onUpdate(AjaxRequestTarget target) { > if (getAction() != null > && getAction().equals(ReportAction.VIEW)) { > startField.setRequired(false); > } else { > startField.setRequired(true); > } > // We update the startField and the DateTimeField inside it. > target.addComponent(startField); > target.addComponent(startField.getComponent()); > } > }); > > Julian > On Thu, Jul 21, 2011 at 12:30 PM, Martin Grigorov <mgrigo...@apache.org> > wrote: >> >> Show some code. >> >> On Thu, Jul 21, 2011 at 10:09 PM, Julian Sinai <jsi...@gmail.com> wrote: >> > Nothing is adding it, we add the DateTimeField itself to the target. >> > >> > Julian >> > On Thu, Jul 21, 2011 at 12:08 PM, Igor Vaynberg >> > <igor.vaynb...@gmail.com>wrote: >> > >> >> what is adding that to the target? >> >> >> >> -igor >> >> >> >> On Thu, Jul 21, 2011 at 12:07 PM, Julian Sinai <jsi...@gmail.com> >> >> wrote: >> >> > It is the hours component of the DateTimeField. From >> >> > DateTimeField.html: >> >> > >> >> > <input type="text" wicket:id="hours" size="2" /> : >> >> > >> >> > Julian >> >> > On Thu, Jul 21, 2011 at 11:24 AM, Igor Vaynberg >> >> > <igor.vaynb...@gmail.com >> >> > >> >> > wrote: >> >> >> >> >> >> what is "hours" ? >> >> >> >> >> >> -igor >> >> >> >> >> >> On Thu, Jul 21, 2011 at 11:17 AM, Julian Sinai <jsi...@gmail.com> >> >> wrote: >> >> >> > Igor, >> >> >> > We do update the DateTimeField itself, and this is what we see: >> >> >> > SEVERE: cannot update component that does not have >> >> >> > setOutputMarkupId >> >> >> > property set to true. Component: [MarkupContainer [Component id = >> >> >> > hours]] >> >> >> > java.lang.IllegalArgumentException: cannot update component that >> >> >> > does >> >> >> > not >> >> >> > have setOutputMarkupId property set to true. Component: >> >> [MarkupContainer >> >> >> > [Component id = hours]] >> >> >> > at >> >> >> > >> >> >> > >> >> >> >> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:346) >> >> >> > >> >> >> > Julian >> >> >> > On Thu, Jul 21, 2011 at 11:02 AM, Igor Vaynberg >> >> >> > <igor.vaynb...@gmail.com> >> >> >> > wrote: >> >> >> >> >> >> >> >> cant update the DateTimeField itself? >> >> >> >> >> >> >> >> -igor >> >> >> >> >> >> >> >> On Thu, Jul 21, 2011 at 10:57 AM, Julian Sinai <jsi...@gmail.com> >> >> >> >> wrote: >> >> >> >> > We have a need to update a DateTimeField via Ajax, but its >> >> >> >> > fields >> >> are >> >> >> >> > private, and they don't have setOutputMarkupId() set on them. >> >> >> >> > The >> >> >> >> > result >> >> >> >> > is >> >> >> >> > an exception upon Ajax update. Is there any solution other than >> >> >> >> > cloning >> >> >> >> > and >> >> >> >> > owning DateTimeField? >> >> >> >> > >> >> >> >> > We are using Wicket 1.4.17 (and we can't upgrade to 1.5 just >> >> >> >> > yet). >> >> >> >> > >> >> >> >> > Any help is appreciated. >> >> >> >> > Julian >> >> >> >> > >> >> >> > >> >> >> > >> >> > >> >> > >> >> >> > >> >> >> >> -- >> Martin Grigorov >> jWeekend >> Training, Consulting, Development >> http://jWeekend.com > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org