You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rubén khanser <kh...@gmail.com> on 2010/02/11 14:25:37 UTC

TextArea in repeater doesn't update it's model

I have an AjaxFallBackLink that executes an update in a service, but i need
the textArea of the same row to be updated. I have wasted all morning but i
can't still make it work.

I reached this point:

         DataView dv = new DataView("dataView",ldp) {
 private static final long serialVersionUID = -3315693391867601086L;

@Override
protected void populateItem(Item arg0) {
Label pagina;
 final Label codi;
final TextArea valor;
AjaxFallbackLink link;
 final StringBuffer vBuffer = new StringBuffer();
 final AccTextosWrapper tWrapper = (AccTextosWrapper)arg0.getModelObject();
pagina = new Label("pagina", tWrapper.getPagina());
 codi = new Label("codi",tWrapper.getCodi());
codi.setOutputMarkupId(true);
 valor = new TextArea("valor", new PropertyModel(tWrapper,"descripcio"));
valor.add(new AjaxEventBehavior("onblur") {
 @Override
protected void onEvent(AjaxRequestTarget arg0) {
 String val = valor.getModelObjectAsString();
vBuffer.delete(0, vBuffer.length());
 vBuffer.append((val == null)?"":val);
 }
 });
valor.setOutputMarkupId(true);
link = new AjaxFallbackLink("link") {
 private static final long serialVersionUID = 3439293533625966929L;

@Override
public void onClick(AjaxRequestTarget arg0) {
 String c = codi.getModelObjectAsString();
 adminService.updateTextDescripcio(c,vBuffer.toString());
  }
};
link.setOutputMarkupId(true);
  arg0.add(pagina);
 arg0.add(codi);
arg0.add(valor);
arg0.add(link);
 }
};

If i don't use validate() and updateModel() i get the same string i had at
the start otherwise i get null.

All works fine but the TextArea model.
Thank you very much for your help

Re: TextArea in repeater doesn't update it's model

Posted by Igor Vaynberg <ig...@gmail.com>.
No point using a submit link if you are going to override onclick with
a non form related Ajax behavior.

-igor

On Friday, February 12, 2010, Rubén khanser <kh...@gmail.com> wrote:
> It still doesn't work. Do I need a form inside my repeater?
>
> protected void populateItem(Item arg0) {
> Label pagina;
>  final Label codi;
> final TextArea valor;
> SubmitLink link;
>   final AccTextosWrapper tWrapper = (AccTextosWrapper)arg0.getModelObject();
>  pagina = new Label("pagina", tWrapper.getPagina());
>  codi = new Label("codi",tWrapper.getCodi());
>  codi.setOutputMarkupId(true);
> valor = new TextArea("valor", new PropertyModel(tWrapper,"descripcio"));
>  valor.setOutputMarkupId(true);
> link = new SubmitLink("link");
>  link.add(new AjaxEventBehavior("onclick") {
>  @Override
>  protected void onEvent(AjaxRequestTarget arg0) {
> valor.validate();
>  valor.updateModel();
> String c = codi.getModelObjectAsString();
> String v = valor.getModelObjectAsString();
>  adminService.updateTextDescripcio(c,v);
>  }
>  });
> link.setOutputMarkupId(true);
>   arg0.add(pagina);
> arg0.add(codi);
>  arg0.add(valor);
> arg0.add(link);
>  }
>
> 2010/2/11 Igor Vaynberg <ig...@gmail.com>
>
>> it has nothing to do with nested forms. regular links do not submit
>> forms, that is how html works. you can either use a button or a
>> submitlink.
>>
>> -igor
>>
>> 2010/2/11 Rubén khanser <kh...@gmail.com>:
>> > Then should I use nestedforms better than this?
>> >
>> > 2010/2/11 Igor Vaynberg <ig...@gmail.com>
>> >
>> >> you need to use a submit link if you want the values to be submitted
>> >> back to the server
>> >>
>> >> -igor
>> >>
>> >> 2010/2/11 Rubén khanser <kh...@gmail.com>:
>> >> > I have an AjaxFallBackLink that executes an update in a service, but i
>> >> need
>> >> > the textArea of the same row to be updated. I have wasted all morning
>> but
>> >> i
>> >> > can't still make it work.
>> >> >
>> >> > I reached this point:
>> >> >
>> >> >         DataView dv = new DataView("dataView",ldp) {
>> >> >  private static final long serialVersionUID = -3315693391867601086L;
>> >> >
>> >> > @Override
>> >> > protected void populateItem(Item arg0) {
>> >> > Label pagina;
>> >> >  final Label codi;
>> >> > final TextArea valor;
>> >> > AjaxFallbackLink link;
>> >> >  final StringBuffer vBuffer = new StringBuffer();
>> >> >  final AccTextosWrapper tWrapper =
>> >> (AccTextosWrapper)arg0.getModelObject();
>> >> > pagina = new Label("pagina", tWrapper.getPagina());
>> >> >  codi = new Label("codi",tWrapper.getCodi());
>> >> > codi.setOutputMarkupId(true);
>> >> >  valor = new TextArea("valor", new
>> PropertyModel(tWrapper,"descripcio"));
>> >> > valor.add(new AjaxEventBehavior("onblur") {
>> >> >  @Override
>> >> > protected void onEvent(AjaxRequestTarget arg0) {
>> >> >  String val = valor.getModelObjectAsString();
>> >> > vBuffer.delete(0, vBuffer.length());
>> >> >  vBuffer.append((val == null)?"":val);
>> >> >  }
>> >> >  });
>> >> > valor.setOutputMarkupId(true);
>> >> > link = new AjaxFallbackLink("link") {
>> >> >  private static final long serialVersionUID = 3439293533625966929L;
>> >> >
>> >> > @Override
>> >> > public void onClick(AjaxRequestTarget arg0) {
>> >> >  String c = codi.getModelObjectAsString();
>> >> >  adminService.updateTextDescripcio(c,vBuffer.toString());
>> >> >  }
>> >> > };
>> >> > link.setOutputMarkupId(true);
>> >> >  arg0.add(pagina);
>> >> >  arg0.add(codi);
>> >> > arg0.add(valor);
>> >> > arg0.add(link);
>> >> >  }
>> >> > };
>> >> >
>> >> > If i don't use validate() and updateModel() i get the same string i
>> had
>> >> at
>> >> > the start otherwise i get null.
>> >> >
>> >> > All works fine but the TextArea model.
>> >> > Thank you very much for your help
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-un

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


Re: TextArea in repeater doesn't update it's model

Posted by Rubén khanser <kh...@gmail.com>.
Ok i got it solved using a Form in each row that contains the textarea and
the submitlink.

Thanks

El 12 de febrero de 2010 09:53, Rubén khanser <kh...@gmail.com> escribió:

> It still doesn't work. Do I need a form inside my repeater?
>
> protected void populateItem(Item arg0) {
>  Label pagina;
>  final Label codi;
> final TextArea valor;
> SubmitLink link;
>   final AccTextosWrapper tWrapper =
> (AccTextosWrapper)arg0.getModelObject();
>  pagina = new Label("pagina", tWrapper.getPagina());
>  codi = new Label("codi",tWrapper.getCodi());
>  codi.setOutputMarkupId(true);
> valor = new TextArea("valor", new PropertyModel(tWrapper,"descripcio"));
>  valor.setOutputMarkupId(true);
> link = new SubmitLink("link");
>  link.add(new AjaxEventBehavior("onclick") {
>  @Override
>  protected void onEvent(AjaxRequestTarget arg0) {
> valor.validate();
>  valor.updateModel();
> String c = codi.getModelObjectAsString();
> String v = valor.getModelObjectAsString();
>  adminService.updateTextDescripcio(c,v);
>  }
>  });
> link.setOutputMarkupId(true);
>   arg0.add(pagina);
> arg0.add(codi);
>  arg0.add(valor);
> arg0.add(link);
>  }
>
> 2010/2/11 Igor Vaynberg <ig...@gmail.com>
>
>> it has nothing to do with nested forms. regular links do not submit
>> forms, that is how html works. you can either use a button or a
>> submitlink.
>>
>> -igor
>>
>> 2010/2/11 Rubén khanser <kh...@gmail.com>:
>> > Then should I use nestedforms better than this?
>> >
>> > 2010/2/11 Igor Vaynberg <ig...@gmail.com>
>> >
>> >> you need to use a submit link if you want the values to be submitted
>> >> back to the server
>> >>
>> >> -igor
>> >>
>> >> 2010/2/11 Rubén khanser <kh...@gmail.com>:
>> >> > I have an AjaxFallBackLink that executes an update in a service, but
>> i
>> >> need
>> >> > the textArea of the same row to be updated. I have wasted all morning
>> but
>> >> i
>> >> > can't still make it work.
>> >> >
>> >> > I reached this point:
>> >> >
>> >> >         DataView dv = new DataView("dataView",ldp) {
>> >> >  private static final long serialVersionUID = -3315693391867601086L;
>> >> >
>> >> > @Override
>> >> > protected void populateItem(Item arg0) {
>> >> > Label pagina;
>> >> >  final Label codi;
>> >> > final TextArea valor;
>> >> > AjaxFallbackLink link;
>> >> >  final StringBuffer vBuffer = new StringBuffer();
>> >> >  final AccTextosWrapper tWrapper =
>> >> (AccTextosWrapper)arg0.getModelObject();
>> >> > pagina = new Label("pagina", tWrapper.getPagina());
>> >> >  codi = new Label("codi",tWrapper.getCodi());
>> >> > codi.setOutputMarkupId(true);
>> >> >  valor = new TextArea("valor", new
>> PropertyModel(tWrapper,"descripcio"));
>> >> > valor.add(new AjaxEventBehavior("onblur") {
>> >> >  @Override
>> >> > protected void onEvent(AjaxRequestTarget arg0) {
>> >> >  String val = valor.getModelObjectAsString();
>> >> > vBuffer.delete(0, vBuffer.length());
>> >> >  vBuffer.append((val == null)?"":val);
>> >> >  }
>> >> >  });
>> >> > valor.setOutputMarkupId(true);
>> >> > link = new AjaxFallbackLink("link") {
>> >> >  private static final long serialVersionUID = 3439293533625966929L;
>> >> >
>> >> > @Override
>> >> > public void onClick(AjaxRequestTarget arg0) {
>> >> >  String c = codi.getModelObjectAsString();
>> >> >  adminService.updateTextDescripcio(c,vBuffer.toString());
>> >> >  }
>> >> > };
>> >> > link.setOutputMarkupId(true);
>> >> >  arg0.add(pagina);
>> >> >  arg0.add(codi);
>> >> > arg0.add(valor);
>> >> > arg0.add(link);
>> >> >  }
>> >> > };
>> >> >
>> >> > If i don't use validate() and updateModel() i get the same string i
>> had
>> >> at
>> >> > the start otherwise i get null.
>> >> >
>> >> > All works fine but the TextArea model.
>> >> > Thank you very much for your help
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

Re: TextArea in repeater doesn't update it's model

Posted by Rubén khanser <kh...@gmail.com>.
It still doesn't work. Do I need a form inside my repeater?

protected void populateItem(Item arg0) {
Label pagina;
 final Label codi;
final TextArea valor;
SubmitLink link;
  final AccTextosWrapper tWrapper = (AccTextosWrapper)arg0.getModelObject();
 pagina = new Label("pagina", tWrapper.getPagina());
 codi = new Label("codi",tWrapper.getCodi());
 codi.setOutputMarkupId(true);
valor = new TextArea("valor", new PropertyModel(tWrapper,"descripcio"));
 valor.setOutputMarkupId(true);
link = new SubmitLink("link");
 link.add(new AjaxEventBehavior("onclick") {
 @Override
 protected void onEvent(AjaxRequestTarget arg0) {
valor.validate();
 valor.updateModel();
String c = codi.getModelObjectAsString();
String v = valor.getModelObjectAsString();
 adminService.updateTextDescripcio(c,v);
 }
 });
link.setOutputMarkupId(true);
  arg0.add(pagina);
arg0.add(codi);
 arg0.add(valor);
arg0.add(link);
 }

2010/2/11 Igor Vaynberg <ig...@gmail.com>

> it has nothing to do with nested forms. regular links do not submit
> forms, that is how html works. you can either use a button or a
> submitlink.
>
> -igor
>
> 2010/2/11 Rubén khanser <kh...@gmail.com>:
> > Then should I use nestedforms better than this?
> >
> > 2010/2/11 Igor Vaynberg <ig...@gmail.com>
> >
> >> you need to use a submit link if you want the values to be submitted
> >> back to the server
> >>
> >> -igor
> >>
> >> 2010/2/11 Rubén khanser <kh...@gmail.com>:
> >> > I have an AjaxFallBackLink that executes an update in a service, but i
> >> need
> >> > the textArea of the same row to be updated. I have wasted all morning
> but
> >> i
> >> > can't still make it work.
> >> >
> >> > I reached this point:
> >> >
> >> >         DataView dv = new DataView("dataView",ldp) {
> >> >  private static final long serialVersionUID = -3315693391867601086L;
> >> >
> >> > @Override
> >> > protected void populateItem(Item arg0) {
> >> > Label pagina;
> >> >  final Label codi;
> >> > final TextArea valor;
> >> > AjaxFallbackLink link;
> >> >  final StringBuffer vBuffer = new StringBuffer();
> >> >  final AccTextosWrapper tWrapper =
> >> (AccTextosWrapper)arg0.getModelObject();
> >> > pagina = new Label("pagina", tWrapper.getPagina());
> >> >  codi = new Label("codi",tWrapper.getCodi());
> >> > codi.setOutputMarkupId(true);
> >> >  valor = new TextArea("valor", new
> PropertyModel(tWrapper,"descripcio"));
> >> > valor.add(new AjaxEventBehavior("onblur") {
> >> >  @Override
> >> > protected void onEvent(AjaxRequestTarget arg0) {
> >> >  String val = valor.getModelObjectAsString();
> >> > vBuffer.delete(0, vBuffer.length());
> >> >  vBuffer.append((val == null)?"":val);
> >> >  }
> >> >  });
> >> > valor.setOutputMarkupId(true);
> >> > link = new AjaxFallbackLink("link") {
> >> >  private static final long serialVersionUID = 3439293533625966929L;
> >> >
> >> > @Override
> >> > public void onClick(AjaxRequestTarget arg0) {
> >> >  String c = codi.getModelObjectAsString();
> >> >  adminService.updateTextDescripcio(c,vBuffer.toString());
> >> >  }
> >> > };
> >> > link.setOutputMarkupId(true);
> >> >  arg0.add(pagina);
> >> >  arg0.add(codi);
> >> > arg0.add(valor);
> >> > arg0.add(link);
> >> >  }
> >> > };
> >> >
> >> > If i don't use validate() and updateModel() i get the same string i
> had
> >> at
> >> > the start otherwise i get null.
> >> >
> >> > All works fine but the TextArea model.
> >> > Thank you very much for your help
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: TextArea in repeater doesn't update it's model

Posted by Igor Vaynberg <ig...@gmail.com>.
it has nothing to do with nested forms. regular links do not submit
forms, that is how html works. you can either use a button or a
submitlink.

-igor

2010/2/11 Rubén khanser <kh...@gmail.com>:
> Then should I use nestedforms better than this?
>
> 2010/2/11 Igor Vaynberg <ig...@gmail.com>
>
>> you need to use a submit link if you want the values to be submitted
>> back to the server
>>
>> -igor
>>
>> 2010/2/11 Rubén khanser <kh...@gmail.com>:
>> > I have an AjaxFallBackLink that executes an update in a service, but i
>> need
>> > the textArea of the same row to be updated. I have wasted all morning but
>> i
>> > can't still make it work.
>> >
>> > I reached this point:
>> >
>> >         DataView dv = new DataView("dataView",ldp) {
>> >  private static final long serialVersionUID = -3315693391867601086L;
>> >
>> > @Override
>> > protected void populateItem(Item arg0) {
>> > Label pagina;
>> >  final Label codi;
>> > final TextArea valor;
>> > AjaxFallbackLink link;
>> >  final StringBuffer vBuffer = new StringBuffer();
>> >  final AccTextosWrapper tWrapper =
>> (AccTextosWrapper)arg0.getModelObject();
>> > pagina = new Label("pagina", tWrapper.getPagina());
>> >  codi = new Label("codi",tWrapper.getCodi());
>> > codi.setOutputMarkupId(true);
>> >  valor = new TextArea("valor", new PropertyModel(tWrapper,"descripcio"));
>> > valor.add(new AjaxEventBehavior("onblur") {
>> >  @Override
>> > protected void onEvent(AjaxRequestTarget arg0) {
>> >  String val = valor.getModelObjectAsString();
>> > vBuffer.delete(0, vBuffer.length());
>> >  vBuffer.append((val == null)?"":val);
>> >  }
>> >  });
>> > valor.setOutputMarkupId(true);
>> > link = new AjaxFallbackLink("link") {
>> >  private static final long serialVersionUID = 3439293533625966929L;
>> >
>> > @Override
>> > public void onClick(AjaxRequestTarget arg0) {
>> >  String c = codi.getModelObjectAsString();
>> >  adminService.updateTextDescripcio(c,vBuffer.toString());
>> >  }
>> > };
>> > link.setOutputMarkupId(true);
>> >  arg0.add(pagina);
>> >  arg0.add(codi);
>> > arg0.add(valor);
>> > arg0.add(link);
>> >  }
>> > };
>> >
>> > If i don't use validate() and updateModel() i get the same string i had
>> at
>> > the start otherwise i get null.
>> >
>> > All works fine but the TextArea model.
>> > Thank you very much for your help
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

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


Re: TextArea in repeater doesn't update it's model

Posted by Rubén khanser <kh...@gmail.com>.
Then should I use nestedforms better than this?

2010/2/11 Igor Vaynberg <ig...@gmail.com>

> you need to use a submit link if you want the values to be submitted
> back to the server
>
> -igor
>
> 2010/2/11 Rubén khanser <kh...@gmail.com>:
> > I have an AjaxFallBackLink that executes an update in a service, but i
> need
> > the textArea of the same row to be updated. I have wasted all morning but
> i
> > can't still make it work.
> >
> > I reached this point:
> >
> >         DataView dv = new DataView("dataView",ldp) {
> >  private static final long serialVersionUID = -3315693391867601086L;
> >
> > @Override
> > protected void populateItem(Item arg0) {
> > Label pagina;
> >  final Label codi;
> > final TextArea valor;
> > AjaxFallbackLink link;
> >  final StringBuffer vBuffer = new StringBuffer();
> >  final AccTextosWrapper tWrapper =
> (AccTextosWrapper)arg0.getModelObject();
> > pagina = new Label("pagina", tWrapper.getPagina());
> >  codi = new Label("codi",tWrapper.getCodi());
> > codi.setOutputMarkupId(true);
> >  valor = new TextArea("valor", new PropertyModel(tWrapper,"descripcio"));
> > valor.add(new AjaxEventBehavior("onblur") {
> >  @Override
> > protected void onEvent(AjaxRequestTarget arg0) {
> >  String val = valor.getModelObjectAsString();
> > vBuffer.delete(0, vBuffer.length());
> >  vBuffer.append((val == null)?"":val);
> >  }
> >  });
> > valor.setOutputMarkupId(true);
> > link = new AjaxFallbackLink("link") {
> >  private static final long serialVersionUID = 3439293533625966929L;
> >
> > @Override
> > public void onClick(AjaxRequestTarget arg0) {
> >  String c = codi.getModelObjectAsString();
> >  adminService.updateTextDescripcio(c,vBuffer.toString());
> >  }
> > };
> > link.setOutputMarkupId(true);
> >  arg0.add(pagina);
> >  arg0.add(codi);
> > arg0.add(valor);
> > arg0.add(link);
> >  }
> > };
> >
> > If i don't use validate() and updateModel() i get the same string i had
> at
> > the start otherwise i get null.
> >
> > All works fine but the TextArea model.
> > Thank you very much for your help
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: TextArea in repeater doesn't update it's model

Posted by Igor Vaynberg <ig...@gmail.com>.
you need to use a submit link if you want the values to be submitted
back to the server

-igor

2010/2/11 Rubén khanser <kh...@gmail.com>:
> I have an AjaxFallBackLink that executes an update in a service, but i need
> the textArea of the same row to be updated. I have wasted all morning but i
> can't still make it work.
>
> I reached this point:
>
>         DataView dv = new DataView("dataView",ldp) {
>  private static final long serialVersionUID = -3315693391867601086L;
>
> @Override
> protected void populateItem(Item arg0) {
> Label pagina;
>  final Label codi;
> final TextArea valor;
> AjaxFallbackLink link;
>  final StringBuffer vBuffer = new StringBuffer();
>  final AccTextosWrapper tWrapper = (AccTextosWrapper)arg0.getModelObject();
> pagina = new Label("pagina", tWrapper.getPagina());
>  codi = new Label("codi",tWrapper.getCodi());
> codi.setOutputMarkupId(true);
>  valor = new TextArea("valor", new PropertyModel(tWrapper,"descripcio"));
> valor.add(new AjaxEventBehavior("onblur") {
>  @Override
> protected void onEvent(AjaxRequestTarget arg0) {
>  String val = valor.getModelObjectAsString();
> vBuffer.delete(0, vBuffer.length());
>  vBuffer.append((val == null)?"":val);
>  }
>  });
> valor.setOutputMarkupId(true);
> link = new AjaxFallbackLink("link") {
>  private static final long serialVersionUID = 3439293533625966929L;
>
> @Override
> public void onClick(AjaxRequestTarget arg0) {
>  String c = codi.getModelObjectAsString();
>  adminService.updateTextDescripcio(c,vBuffer.toString());
>  }
> };
> link.setOutputMarkupId(true);
>  arg0.add(pagina);
>  arg0.add(codi);
> arg0.add(valor);
> arg0.add(link);
>  }
> };
>
> If i don't use validate() and updateModel() i get the same string i had at
> the start otherwise i get null.
>
> All works fine but the TextArea model.
> Thank you very much for your help
>

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