I tried that.  It didn't work.

Actually Component#setDefaultModelObject() already calls
modelChanging();
model.setObject(object);
modelChanged();

I also looked at the ajax guestbook example.



igor.vaynberg wrote:
> 
> call form.modelchanged() after setting the new model
> 
> -igor
> 
> On Mon, Jan 25, 2010 at 9:23 PM, Flavius <flav...@silverlion.com> wrote:
>>
>> I have a panel with a form on it.  I've attached an ajaxButton to submit
>> the form.  Afterward, I want the inputs to be reset with the backing
>> model
>> reset.  I've done a lot of refreshing with an ajax submit, but I can't
>> seem
>> to get the form's values to reset in the webpage.  The backing model
>> seems
>> to be reset, but when I add the form (or it's individual children) to the
>> target,
>> they don't refresh.
>>
>> I've done a variation of this where I have a repeating view up top and
>> when
>> that row is selected, it would populate the form, but I had to put the
>> form
>> in a fragment and add the fragment to the target to get that to work.
>>  Can
>> somebody tell me what I'm doing wrong here?
>>
>> Thanks
>>
>> public class MyPanel extends Panel
>> {
>>        public MyPanel(String id, Widget myWidget)
>>        {
>>                MyForm myForm = new MyForm("myForm", new MyWidget());
>>                add(myForm);
>>                add(new AjaxButton("saveLink", myForm)
>>                {
>>                       �...@override
>>                        protected void onSubmit(AjaxRequestTarget target,
>> Form form)
>>                        {
>>                                //save stuff
>>                                //refresh repeating view
>>                                //now reset the form so the input fields
>> are
>> cleared and there's
>>                                //a new backing model
>>                                form.clearInput();  //this isn't working
>>                                form.setDefaultModelObject(new
>> MyWidget());
>> //this seems to reset the backing model, but the inputs are still
>> popuated
>> on the page
>>                                target.addComponent(form);
>>                        }
>>                }
>>        }
>>
>>        private MyForm myForm extends Form
>>        {
>>                public MyForm(String id, Widget myWidget)
>>                {
>>                        TextField textField = new
>> TextField<String>("myField", new PropertyModel<String>(myWidget,
>> "myField"));
>>                        add(textField);
>>                        ...
>>                }
>>        }
>> }
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Resetting-a-form-after-ajax-submit-tp27318108p27318409.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to