I've developed a custom form component (FormComponentPanel), a date picker, that makes use of 2 fields - a display TextField and a HiddenField for the model data. I'm then adding this to the page with a span tag:
<span wicket:id="dropoffDate">[dropoff date picker]</span>

Then in the java :
DatePicker dropoffDatePicker = new DatePicker("dropoffDate", new PropertyModel<LocalDate>(this, "dropoffDate"), (new LocalDate()).minusDays(0), (new LocalDate()).plusYears(3));

I'm after some advice on the best way to attach an AJAX behaviour to the component. If for example I add an AJAX behaviour directly to the date picker component then it's attached to the span tag and obviously doesn't work. The only way I've found to get around this is to expose the date display field with a public getter so I can then attach the onchange event.

dropoffDatePicker.getDateDisplayField().add(new AjaxFormComponentUpdatingBehavior("onchange") {
            protected void onUpdate(AjaxRequestTarget target) {

Any suggestions for a better way to do this that doesn't involve exposing the innards?

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to