Hi,
On Mon, Apr 9, 2012 at 6:50 PM, Frederico Rodrigues
<[email protected]> wrote:
> Hello
>
> I have implement wicket wizard, but i have a small problem, i have an
> ajaxbutton and i want update the model, but only have success with this when
> i call processInput() inside the onclick event, there is another solution
> for this? i don´t want to call processInput() for all components inside the
> form.
>
> my code:
>
> public ClientStep(IDynamicWizardStep step,String label)
> {
> super(step);
> ....
> IModel<Client> model= new Model<Client>(client);
>
> setSummaryModel(new StringResourceModel("client.summary", this,
> model));
> .
>
> final TextField<String> field= new
> TextField<String>("client.field",new PropertyModel<String>(client, "field"){
> @Override
> public String getObject() {
> return client.getField();
> }
> @Override
> public void setObject(String object) {
> client.setField(object);
> }
No need to override setObject/getObject. PropertyModel does this for you.
> });
> clientContainer.add(nif);
>
>
> AjaxButton fieldSearch=new AjaxButton("fieldSearch"){
> @Override
> protected void onSubmit(AjaxRequestTarget art,
> Form<?> form) {
> // field.processInput();
> Client=...
>
> art.add(clientContainer);
> }
> @Override
> protected void onError(AjaxRequestTarget art,
> Form<?> form) {
> }
> };
>
> fieldSearch.setDefaultFormProcessing(false);
The problem is in the above line. It says "just call button's
#onSubmit() without actually doing the submit.
> clientContainer.add(fieldSearch);
> .................................................................
>
> public NewContract(String id)
> {
> super(id);
>
> setDefaultModel(new CompoundPropertyModel<NewContract>(this));
> DynamicWizardModel model = new DynamicWizardModel(new
> ClientStep(null,"client"));
> // initialize the wizard with the wizard model we just built
> init(model);
> }
> ************************************************
> thanks
>
> Frederico Rodrigues
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com