Nobody? Am I the only one having problems with these fields? Thanks,
Eduardo. On 11/25/08, Eduardo Simioni <[EMAIL PROTECTED]> wrote: > > Thanks for the hints. > > The conversion using nested models worked, although I have had to do some > ugly things in the code because, unlike other fields, date fields model's > don't get automatically updated when the form model is updated. Probably > because of the converter model, it would definitely be better if we could > work with something more "magic". But for now that's ok. > > The problem now is that the date fields don't show up as expected in the > page. I tried the DateTextField as in the examples but the button to open > the calendar pop-up is not showing in the page. > The DateTimeField (my first option) has a different problem, it shows an > extra field that does nothing, I could not manage to remove it. Are these > known bugs? I'm using 1.4-m3. > > See this image: http://www.simioni.net/wicket-date-fields-problems.jpg > > The relevant parts of the code for the class and page are the following: > > Class: > private class RankingForm extends EntityForm<Ranking> { > > private CalendarToDateModel modelStartDate; > private CalendarToDateModel modelEndDate; > > public RankingForm( IModel<Ranking> model, Component dataTable ) { > super( model, dataTable ); > add( new TextField<Ranking>( "name" ) ); > modelStartDate = new CalendarToDateModel( new > PropertyModel<Calendar>( model, "startDate" ) ); > add( new DateTextField( "startDate", modelStartDate, new > StyleDateConverter( "SM", false ) ) ); > modelEndDate = new CalendarToDateModel( new > PropertyModel<Calendar>( model, "endDate" ) ); > add( new DateTimeField( "endDate", modelEndDate ) ); > add( new TextField<Ranking>( "scoreRight" ) ); > add( new TextField<Ranking>( "scoreWrong" ) ); > add( new TextField<Ranking>( "scoreLimit" ) ); > } > > @Override > public MarkupContainer setDefaultModel( IModel<?> model ) { > modelStartDate.setDefaultModel( new PropertyModel<Calendar>( > model, "startDate" ) ); > modelEndDate.setDefaultModel( new PropertyModel<Calendar>( > model, "endDate" ) ); > return super.setDefaultModel( model ); > } > ... > > HTML: > <form wicket:id="form"> > <h2 wicket:id="createEdit">Criar/Editar Ranking</h2> > <div id="feedbackPanel" wicket:id="feedbackPanel">Feedback > Panel</div> > <label for="name">Nome</label>: <input wicket:id="name" > type="text" size="20"/><br /> > <label for="startDate">Data/Hora InĂcio</label>: <input > type="text" wicket:id="startDate"/><br /> > <label for="endDate">Data/Hora Fim</label>: <input type="text" > wicket:id="endDate"/><br /> > <label for="scoreRight">Pontos para Acerto</label>: <input > wicket:id="scoreRight" type="text" size="10"/><br /> > <label for="scoreWrong">Pontos para Erro</label>: <input > wicket:id="scoreWrong" type="text" size="10"/><br /> > <label for="scoreLimit">Limite de Pontos</label>: <input > wicket:id="scoreLimit" type="text" size="10"/><br /> > ... > > > Does anyone know a solution for these problems? > > Thanks! > > Eduardo. > > > On 11/24/08, Jeremy Thomerson <[EMAIL PROTECTED]> wrote: >> >> Yes - this would be a perfect time for a nested model - write a generic >> model that implements IModel<Date> and takes an IModel<Calendar> as its >> input. >> >> See >> >> http://www.jeremythomerson.com/blog/2008/11/06/wicket-the-power-of-nested-models/ >> for >> assistance with the rest. >> >> >> -- >> Jeremy Thomerson >> http://www.wickettraining.com >> >> >> >> >> On Mon, Nov 24, 2008 at 3:08 PM, Igor Vaynberg <[EMAIL PROTECTED] >> >wrote: >> >> >> > write a model that converts to and from. >> > >> > -igor >> > >> > On Mon, Nov 24, 2008 at 12:30 PM, Eduardo Simioni >> > <[EMAIL PROTECTED]> wrote: >> > > Hi all, >> > > >> > > I'm trying to use the DateTimeField from the wicket-datetime project. >> But >> > I >> > > realized that it's stuck to java.util.Date, all my entities use >> > > java.util.Calendar to store dates. So the question is: Is there a >> clean >> > way >> > > to work with DateTimeField and java.util.Calendar "targets"? >> > > I tried to find something in the list archive but looks like everybody >> > uses >> > > java.util.Date, or I'm missing something silly. >> > > >> > > Thanks! >> > > >> > > Eduardo.* >> > > * >> > > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >
