You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jorg Heymans <jh...@domek.be> on 2004/11/11 13:45:30 UTC

Re: unrolling the form loop (was Re: Repeater insert-node does not bind??)


Joerg Heinicke wrote:
> 
> 
> The function showForm() is a bit more complex. You need at least the 
> this.form.process(formContext) stuff which also returns the value 
> finished for the while loop.
> 
> http://svn.apache.org/viewcvs.cgi/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js?rev=54109&view=markup 

Thanks for pointing that out.

The unrolled loop now looks like (form2 is my formobject)

--------------
var bizData = new Object();
bizData[Packages.o.a.c.f.transformation.FormsPipelineConfig.CFORMSKEY] 
       	=form2.form;
if (form2.form.locale == null){
     form2.form.locale = java.util.Locale.getDefault();
}
bizData["locale"] = form2.form.locale;

while (true){
  var result = cocoon.sendPageAndWait("uri",{"CocoonFormsInstance": 
form2.form});
  var formContext = new Packages.o.a.c.forms.FormContext(
cocoon.request, form2.form.locale);

//could not access form2.form.avalonContext for some reason
//var objectModel = 
//org.apache.cocoon.components.ContextHelper.getObjectModel(form2.form.avalonContext);
//   org.apache.cocoon.components.flow.flowHelper.setContextObject(
//objectModel, bizData);

  var finished = form2.form.process(formContext);
  //this causes an exception
  form2.binding.saveFormToModel(form2.form, campaignFormBean);
  if (finished){
     print("finished form");
     break;
  }
  print("redisplaying form");
}
-------------------

But i'm getting Exception trying to remove xpath .; Cannot modify 
property: mybean.participants; java.lang.reflect.InvocationTargetException

This happens when nodes are removed from the repeater.

I have public get and set methods for the ArrayList "participants" in 
mybean with a binding that used to work before
<fb:repeater id="participants" parent-path="." row-path="participants">

Did i step on something i shouldn't ?

regards
Jorg


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


Re: unrolling the form loop (was Re: Repeater insert-node does not bind??)

Posted by Jorg Heymans <jh...@domek.be>.
<snipped what="perfectly fine code">

> I have public get and set methods for the ArrayList "participants" in 
> mybean with a binding that used to work before

well i meant here "before i messed with it and forgot all about it".

Bean is now updating fine during repeater add/remove actions.
Thanks a lot for your help Joerg.

Regards
Jorg


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