You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by H....@MI.unimaas.nl on 2004/07/16 11:05:55 UTC

how to avoid 'generator already set' error?

Hi,

I have this bit of flow script:

function myFunction() {
var form = new Form(formDef);
form.createBinding(formBind);
var success = false;
var errMsg = "";
var count = 0; // to prevent endless loops
while(!success && count < 10) {
   try {
      form.load(myForm);
     	var viewData = { some: data, errMsg: errMsg };
	form.showForm(formDisplayPipeline, viewData);
	form.save(myForm);
      success = myHelper.storeNewForm(myForm);
   }
   catch(error) {
      errMsg = "other error: " + error;
	print(errMsg);
	success = false;
   }
   count++;
}
cocoon.sendPage("displayResult");
}

FormDisplayPipeline points to a pipeline:

<map:generate type="jx" src="myTemplate.jx"/>
<map:transform type="cinclude"/>
<map:transform type="forms"/>
<map:transform src="stylesheets/resources/forms-samples-styling.xsl">
   <map:parameter name="uri" value="stylesheets/resources"/>
</map:transform>
<map:call resource="html-layout"/>
<map:serialize type="html"/>

The above works ok. However, when something happens errMsg is set and the
loop starts from the top, but rather than redisplaying the form, I get an
error message stating 'Generator already set'. This repeats until count==10.

What should I do to redisplay the form properly with error message?

Thanks.

Bye,
Helma van der Linden

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