You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dorothée Giernoth <Do...@kds-kg.de> on 2009/05/26 16:27:18 UTC

AjaxEditableLabel ... but how to get the changed value?

I know this must be a stupid question for all the not-wicket-newbies, but I can't seem to find a solution.
I have a RepeatingView with AjaxEditableLabels that contain information from database:

	cell.add(new AjaxEditableLabel(cell.newChildId(), 
						 new Model(list.get(j))));

Now I want to write the changed information from these labels back into the database after the content has changed. Wouldn't be too much of a problem if I knew how to retrieve the changed value from the label. I really have no clue how to do that!

Hope someone can shed some light! Maybe just a tiny code fragment, that could help me. Thanx in advance!

- dg

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


Re: AjaxEditableLabel ... but how to get the changed value?

Posted by Carl-Eric Menzel <cm...@users.bitforce.com>.
On Tue, 26 May 2009 16:27:18 +0200
Dorothée Giernoth <Do...@kds-kg.de> wrote:

> Now I want to write the changed information from these labels back
> into the database after the content has changed. Wouldn't be too much
> of a problem if I knew how to retrieve the changed value from the
> label. I really have no clue how to do that!

Override the onSubmit() method, like this (untested, but you get the
gist):

cell.add(new AjaxEditableLabel(cell.newChildId(), new Model(...)) {
  protected void onSubmit(AjaxRequestTarget target) {
    super.onSubmit(target);
    String value = getDefaultModelObject();
    // persist value here...
  }
});

Alternatively, if you keep a reference to the model you pass to the
AjaxEditableLabel, you can read its contents at some other point.

Grüße
Carl-Eric

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