cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject flowscript execution order going wrong
Date Thu, 19 Aug 2004 16:48:28 GMT
Hi All

I am wracking my brains over a strange problem in FlowScript.

I have a form, where you can add items to a Repeater. As there are 
24,000 possible items that may be added, I have a separate (non-cforms) 
screen to allow you to search and browse for items to add. When this 
function returns, my code somehow gets back into that function and I 
get a stack overflow. I wrote code similar to this on a project that 
used 2.1.4, without this problem.

Here is a cutdown version of the code:

function doUploadImage(form) {
	<snip/>
	while (true) {
		cocoon.log.info("started while loop in doUploadImage");
		form.load(image);
		<snip/>
		cocoon.log.info("showing IMAGE form");
		form.showForm(cocoon.parameters["screen"], selections);
		cocoon.log.info("IMAGE form submitted with: " + form.submitId);
		if ("choosemesh".equals(form.submitId)) {
			cocoon.log.info("chooseMesh about to be called");
			chooseMesh(factory, form, image);
			cocoon.log.info("doUploadImage continue from chooseMesh");
			continue;
		} else if ("submit".equals(form.submitId)) {
			<snip/>
		}
		<snip/>
	} // end while
	<snip/>
}

function chooseMesh (factory, form, image) {
	<snip/>
	try {
		while (true) {
			cocoon.log.info ("started while loop in chooseMesh");
			cocoon.sendPageAndWait ("screen/choosemesh", {record: record, term: 
term, page: page, results: results});
			var command = cocoon.request.get ("COMMAND_PARAM");
			if ("CANCEL_ACTION".equals (command)) {	// user cancelling
				cocoon.log.info ("chooseMesh, break from CANCEL_ACTION");
				break;
			} else if ("NAV_ACTION".equals (command)) {
				<snip/>
			} else if ("SEARCH_ACTION".equals (command)) {
				<snip/>
			} else if ("PAGE_ACTION".equals (command)) {				<snip/>
			} else if ("CHOOSE_ACTION".equals (command)) {				<snip/>
			}
		} // end while
		<snip/>
	} catch (e) {
		<snip/>
	} finally {
		<snip/>
		cocoon.log.info ("exiting chooseMesh");
	}
}

so, if I run the code, this is the trace in flow.log, when I activate 
the 'chooser' then hit the 'cancel' button :

INFO    started while loop in doUploadImage
INFO    showing IMAGE form
INFO    IMAGE form submitted with: choosemesh
INFO    chooseMesh about to be called
INFO    started while loop in chooseMesh
INFO    chooseMesh, break from CANCEL_ACTION
INFO    exiting chooseMesh
INFO    doUploadImage continue from chooseMesh
INFO    started while loop in doUploadImage
INFO    showing IMAGE form

up until here, everything behaves as you would expect
but then, the code dives back into the middle of the chooseMesh function

INFO    chooseMesh, break from CANCEL_ACTION
INFO    exiting chooseMesh
INFO    doUploadImage continue from chooseMesh
INFO    started while loop in doUploadImage
INFO    showing IMAGE form
INFO    chooseMesh, break from CANCEL_ACTION
INFO    exiting chooseMesh
. . . repeats . . .

What am I doing wrong ????

Thanks for any sugestions

regards Jeremy

--------------------------------------------------------

                   If email from this address is not signed
                                 IT IS NOT FROM ME

                         Always check the label, folks !!!!!
--------------------------------------------------------

Mime
View raw message