You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Sandor Feher <sf...@bluesystem.hu> on 2012/06/12 15:08:36 UTC

Nested form model refresh

Hi,

I have the following form. It has a nested form which is for a simple file
uploading. After the upload finished I would like to get some information
from the uploaded file (eg. name, size and so one) and pass it's parent
form. Later if the parent form get submitted I will persist these data and
the file itself in HrpFiles entity.
My problem is that parent form's fields did not get refreshed.

http://pastebin.com/GaJZu8zT

TIA,

Sandor

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Nested-form-model-refresh-tp4649877.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: Nested form model refresh

Posted by Sandor Feher <sf...@bluesystem.hu>.
Hi,

Works fine! Thank you so much for your help!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Nested-form-model-refresh-tp4649877p4649910.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: Nested form model refresh

Posted by Andrea Del Bene <an...@gmail.com>.
Sorry, I've missed an important step. You should call clearInput() on 
the outer form. You could try with something like this:

....
cmodel.setObject(e);
((Form)form.getParent()).clearInput();
art.add(cont);

> Hi,
>
>
> Tried but did not work for me :(
>
>
> .............
>
>      info("saved file: " + uploadedFile.getClientFileName());
>                          HrpFiles e=new HrpFiles();
>                          e.setTitle(uploadedFile.getClientFileName());
>                          cmodel.setObject(e);
>                          art.add(cont);
> ............
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Nested-form-model-refresh-tp4649877p4649884.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
>


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


Re: Nested form model refresh

Posted by Sandor Feher <sf...@bluesystem.hu>.
Hi,


Tried but did not work for me :(


.............

    info("saved file: " + uploadedFile.getClientFileName());
                        HrpFiles e=new HrpFiles();
                        e.setTitle(uploadedFile.getClientFileName());
                        cmodel.setObject(e);                        
                        art.add(cont);
............


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Nested-form-model-refresh-tp4649877p4649884.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: Nested form model refresh

Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Hi,

looking at your code I've noticed these two lines at the end of onSubmit 
of AjaxButton:

setModel(new CompoundPropertyModel(e));
modelChanged();

here you are changing the button's model and not the one of the parent 
form (the variable cmodeldefined above ), hence its components won't 
display the expected values. Try declaring cmodelas final and replacing 
the two line of codes with:

cmodel.setObject(e);
> Hi,
>
> I have the following form. It has a nested form which is for a simple file
> uploading. After the upload finished I would like to get some information
> from the uploaded file (eg. name, size and so one) and pass it's parent
> form. Later if the parent form get submitted I will persist these data and
> the file itself in HrpFiles entity.
> My problem is that parent form's fields did not get refreshed.
>
> http://pastebin.com/GaJZu8zT
>
> TIA,
>
> Sandor
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Nested-form-model-refresh-tp4649877.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
>


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