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

Reply via email to