cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Kjeldahl Nilsson ...@marcello.no>
Subject Re: how to avoid 'generator already set' error in flowscript loop? RE POST
Date Mon, 26 Jul 2004 08:52:07 GMT
Hello,

I have very limited knowledge of cforms, but I've had some problems with 
the "jx generator already set" error on my current project.
Generally, I get this error when I do something like this:

myFunction(){

    try{
	[something]
    }
    catch(error){
	cocoon.sendPage([error message])
    }

    cocoon.sendPage([result])

}


I got this error because when catching errors and sending the error 
message with a sendPage() call rather than sendPageAndWait() the error 
was displayed but the flowscript went on to the next sendPage() after 
the catch statement, triggering the "jx generator already set" error.

Not sure if this helps you, but I'd look into what happens when you show 
your form. Does the flowscript really wait for user input, or does it 
try the next loop iteration\form display immediately, causing the "jx 
generator already set"?

Just an idea.

-ThomasN


H.vanderLinden@MI.unimaas.nl wrote:
> Guys,
> 
> anyone? Please help.
> 
> Thanks.
> 
> Bye, Helma
> 
> 
>>-----Original Message-----
>>From: H.vanderLinden@MI.unimaas.nl 
>>[mailto:H.vanderLinden@MI.unimaas.nl] 
>>Sent: Friday, 16 July 2004 11:06
>>To: users@cocoon.apache.org
>>Subject: 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
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

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


Mime
View raw message