You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by armandoxxx <ar...@dropchop.com> on 2010/10/05 16:27:14 UTC

Form model changes when onSubmit method is called for the first time.

Hey ppl

Got a little problem with a form onSubmit().
A form (for translations, IModel<Translation> ) has a DropDownChoice (to
select a language and holds list of Language objects) and a ListView with
panels that are wrapper for other fields (TextField, TextAreaField. etc). 
example:
Form
   DropdownChoice (Language selection)
   Panel1
       Label
       TextField  (fot title)
   Panel2
       Label
       TextAreaField (for description)
  Submit

Another component on same page is a DataGridView to list Translation records
from data source. 

The problem is when I press submit button and onSubmit() method is executed. 
- If form is empty, meaning form was never populated before, the
getDefaultModelObject() method returns Language object , which is obviously
the wrong object, cause I specificaly set it to the same that grid uses
(Translation).

- If I select a record from grid and form gets populated with record data,
onSubmit()  I get the Translation object which is the one I wanted.

Does anyone have any idea what's wrong ? Any tip would be fine. 

Some info:
- onInitialize() method returns Translation object when
getDefaultModelObject() is called. 

kind regards

Armando





-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Form-model-changes-when-onSubmit-method-is-called-for-the-first-time-tp2956133p2956133.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Form model changes when onSubmit method is called for the first time.

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Show some code.

On Tue, Oct 5, 2010 at 9:27 AM, armandoxxx <ar...@dropchop.com> wrote:

>
> Hey ppl
>
> Got a little problem with a form onSubmit().
> A form (for translations, IModel<Translation> ) has a DropDownChoice (to
> select a language and holds list of Language objects) and a ListView with
> panels that are wrapper for other fields (TextField, TextAreaField. etc).
> example:
> Form
>   DropdownChoice (Language selection)
>   Panel1
>       Label
>       TextField  (fot title)
>   Panel2
>       Label
>       TextAreaField (for description)
>  Submit
>
> Another component on same page is a DataGridView to list Translation
> records
> from data source.
>
> The problem is when I press submit button and onSubmit() method is
> executed.
> - If form is empty, meaning form was never populated before, the
> getDefaultModelObject() method returns Language object , which is obviously
> the wrong object, cause I specificaly set it to the same that grid uses
> (Translation).
>
> - If I select a record from grid and form gets populated with record data,
> onSubmit()  I get the Translation object which is the one I wanted.
>
> Does anyone have any idea what's wrong ? Any tip would be fine.
>
> Some info:
> - onInitialize() method returns Translation object when
> getDefaultModelObject() is called.
>
> kind regards
>
> Armando
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Form-model-changes-when-onSubmit-method-is-called-for-the-first-time-tp2956133p2956133.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com