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 <[email protected]>
> 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 <[email protected]>:
> > Then should I use nestedforms better than this?
> >
> > 2010/2/11 Igor Vaynberg <[email protected]>
> >
> >> 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 <[email protected]>:
> >> > 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: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>