Since you're dealing with setConvertedInput I presume you're
implementing FormComponentPanel. In that case, you need a single model
object to encapsulate the idea of a date range. For example, you could
implement your own DateRange class. Pass your panel a model that returns
and accepts instances of DateRange, and set your converted input to an
instance of DateRange.

An alternate way is to use a regular Panel instead of a
FormComponentPanel and pass it two models, one for the start date and
one for the end date. You'll probably want to pass in the encapsulating
Form object too, so you can add a FormValidator to ensure end > start.

jk

On Mon, Apr 20, 2009 at 09:38:46PM -0700, Kurt Heston wrote:
> I guess I also need to ask an even simpler question: can I manage two 
> fields in the same IModel within a single form component?
> 
> Kurt Heston wrote:
> >I'm building a StartAndEndDateTime form component based on Eelco's 
> >DateTimeField.  It is essentially the same as his with the time fields 
> >repeated.
> >
> >The goal is to get my new custom component to update two date fields 
> >in the parent form's model.  Here is what the end of my convertInput() 
> >method look like:
> ><pre>
> >       Object mdlObj = getForm().getModelObject();
> >       new PropertyModel(mdlObj, "svcDate").setObject(new Date(date
> >           .getMillis()));
> >       new PropertyModel(mdlObj, "endSvcDate").setObject(new Date(endDate
> >           .getMillis()));
> >
> >       setConvertedInput(<tried a number of things here>);
> ></pre>
> >
> >I'm doing something wrong with setConvertedInput:
> >
> ><pre>
> >ERROR org.apache.wicket.RequestCycle  - Error calling method: public 
> >void MyClass.setSvcDate(java.util.Date) on object: mycl...@e56328
> ></pre>
> >
> >If I'm setting two fields in the Model, what should I pass to 
> >setConvertedInput?
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to