Re: (Form) Use two TextFields for one object property? (SOLVED)

2010-02-19 Thread Eelco Hillenius
> A thousand thanks. Works like a charm. > Though I don't fully understand how the values are > passed through the components/models. It's three components, one parent (that holds the ultimate value) and two children (that both hold values used to calculate the parent value. > convertinput() { >

Re: (Form) Use two TextFields for one object property? (SOLVED)

2010-02-19 Thread srm
> class lengthtextfield extends formcomponentpanel { > private final textfield minutes; > private final textfield seconds; > > public lengthtextfield(string id, imodel model) { > super(id, model); > minutes=new textfield("min",new model(model.getobject()/60),integer.class); > seconds=new textfi

Re: (Form) Use two TextFields for one object property?

2010-02-18 Thread Andrew Lombardi
class MyForm extends Form { private int hour; private int second; public Form { add(new TextField("hour", new PropertyModel(MyForm.class, "hour"))); add(new TextField("second", new PropertyModel(MyForm.class, "second"))); } public void onSubmit() { if(!validTime(

Re: (Form) Use two TextFields for one object property?

2010-02-18 Thread srm
Am 18.02.2010 um 23:08 schrieb Igor Vaynberg: > > -igor > Thank you, I have to look into this as I have never directly worked with the FormComponentModel. Every day something new :) Regards, Stephan > On Thu, Feb 18, 2010 at 2:02 PM, srm wrote: >> >> Am 18.02.2010 um 22:56 schrieb Andrew

Re: (Form) Use two TextFields for one object property?

2010-02-18 Thread Igor Vaynberg
class lengthtextfield extends formcomponentpanel { private final textfield minutes; private final textfield seconds; public lengthtextfield(string id, imodel model) { super(id, model); minutes=new textfield("min",new model(model.getobject()/60),integer.class); seconds=new textfield("min",new

Re: (Form) Use two TextFields for one object property?

2010-02-18 Thread srm
Am 18.02.2010 um 22:56 schrieb Andrew Lombardi: > It depends what your domain object looks like, if it's just a simple string > you'll have to save the results of those two textfield's in their own model, > and then merge them in the onSubmit method. > It's a int property. I was thinking abou

Re: (Form) Use two TextFields for one object property?

2010-02-18 Thread Andrew Lombardi
It depends what your domain object looks like, if it's just a simple string you'll have to save the results of those two textfield's in their own model, and then merge them in the onSubmit method. On Feb 18, 2010, at 1:41 PM, srm wrote: > Hi List, > > the following may looked flawed, so I'm ha

(Form) Use two TextFields for one object property?

2010-02-18 Thread srm
Hi List, the following may looked flawed, so I'm happy to hear your suggestions: I have a RegisterNewItem Form where a user can add new Items to a shop/database. I have items of type CD (audiocd) with an attribute PlayTime. I store this value as seconds and calculate the minutes to display at r