Re: When to use getModelObject, getConvertedInput, getInput

2007-12-12 Thread wicket user
Ok that's cool but on an AjaxFormComponentUpdatingBehavior the model is
null/hasn't been set so you can't use it? What happens if you want to base a
decision on the value that the user has just changed to?



On 11/12/2007, Johan Compagner [EMAIL PROTECTED] wrote:

 you shouldn't call getConvertedInput() or getInput yourself except if you
 where making a special formcomponent itself.
 The model of an component lives as long as the component does.

 But the dropdownchoice (or all select tag components) have another special
 thing call IChoiceRenderer
 That first tries to convert the string to an option object.

 johan


 On Dec 11, 2007 1:47 PM, wicket user [EMAIL PROTECTED] wrote:

  Hi,
 
  This is more a question of understanding models and input of a
 particular
  component, lets say DropDownChoice (DDC) for example.
 
  You give it a model initially on creation, this has nothing to do with,
 in
  the case of a DDC the selected values as that is supplied by the Choices
  paramater in the constuctor.
 
  So we now have a DDC configured.
 
  A user comes along and selects a value, if we have and
  AjaxFormComponentUpdatingBehavior associated we see that the
  getModelObject
  returns null as well as getConvertedInput but getInput actually has
  something but it's in string form. Is this because we are intercepting
 the
  event before the input is converted to the model?
 
  Basically I'm never sure when to use which accessor and the trial and
  error
  method that I have been using so far is starting to scare me. I guess
 the
  lifecycle of model is what I really need to understand and googling
 hasn't
  thrown up much. I have read the wiki article on models but it doesn't go
  into details such as this...
 
  Anyway, it will be a nice thing to not have nagging me over xmas!
 
  thanks
  simon
 



When to use getModelObject, getConvertedInput, getInput

2007-12-11 Thread wicket user
Hi,

This is more a question of understanding models and input of a particular
component, lets say DropDownChoice (DDC) for example.

You give it a model initially on creation, this has nothing to do with, in
the case of a DDC the selected values as that is supplied by the Choices
paramater in the constuctor.

So we now have a DDC configured.

A user comes along and selects a value, if we have and
AjaxFormComponentUpdatingBehavior associated we see that the getModelObject
returns null as well as getConvertedInput but getInput actually has
something but it's in string form. Is this because we are intercepting the
event before the input is converted to the model?

Basically I'm never sure when to use which accessor and the trial and error
method that I have been using so far is starting to scare me. I guess the
lifecycle of model is what I really need to understand and googling hasn't
thrown up much. I have read the wiki article on models but it doesn't go
into details such as this...

Anyway, it will be a nice thing to not have nagging me over xmas!

thanks
simon