wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucast <lucastol...@hotmail.com>
Subject Re: Wicket Cookbook - preventing multiple form submits
Date Thu, 19 May 2011 11:09:44 GMT
Hi Andrea,
Thanks for your reply.
I call updateProcessedForms() AND THEN super.process(submittingComponent).
The reverse order to what it is shown on pg 49 on book. I described it wrong
on original post, I apologise. It is now corrected.

When calling createPerson Panel, I execute the following in order to create
new instance of person variables:
public CreatePersonPanel(String id, WebPage parentPage){
		super(id);
		setDefaultModel(new Model<Person>(new Person(new
PersonCreatedTimestamp()));
		add( new PersonForm( "personCreationForm", (IModel<Person>)
getDefaultModel() ) );
                ...
	}
And for editing I do the following:

public CreatePersonPanel(String id, Long personId , WebPage parentPage){
     	super( id, new LoadablePersonModel(personId) );
     	this.parentPage = parentPage;
        add( new PersonForm( "personCreationForm", (IModel<Person>)
getDefaultModel() ) );
     	...         
	}

Inside the form, I get a copy of the default model object:
public EventForm(String id, IModel<Person> model) {
			super(id, model);
			 person = (Person) this.getDefaultModel().getObject();
...
}
When submitting the form, I simply call the following service passing the
person object I extracted from the default model, as shown above:
WicketApplication.get().getPersons_service().savePerson(person);

The only place where I create a new instance of person is when I first call
the createPersonPanel.
I hope this helps. Thanks for looking into it.
Lucas


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Cookbook-preventing-multiple-form-submits-tp3535159p3535415.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


Mime
View raw message