On 25 Nov 2003, at 14:35, Jeremy Quinn wrote:

As an aside ..... I have found situations whereby cocoon.redirectTo ("blah") does AbsolutelyNothing™, for no good reason .... a bit disturbing (!!!)


Here is a script example where cocoon.redirectTo does nothing (for reasons I do not understand).
Click the 'Done' button with the script below and you get a blank page :

function updateAlbum (form) {
var factory = cocoon.getComponent (PersistanceFactory.ROLE);
var session = factory.createSession ();
var userid = cocoon.parameters["userid"];
var screen = cocoon.parameters["screen"];
var album = AlbumPeer.load (session, new java.lang.Long (cocoon.parameters["assetid"]), null);
if (album != null) {
if (album.user.id.toString ().equals (userid)) {
try {
while (true) { // stay in the form until they click 'cancel' or 'done'
form.load (album);
session.close();
form.showForm (screen);
if ("cancel".equals (form.submitId)) {
cocoon.sendPage ("screen/cancel", {message: "myalbums.cancel.update"});
break;
}
session = factory.createSession ();
form.save (album);
if (!AlbumPeer.save (session, album)) {
cocoon.log.error ("error while saving album: " + album.getTitle ());
cocoon.sendPage ("screen/error", {message: "myalbums.album.saveerror"});
break; // Transaction already rolled-back
}
if ("done".equals (form.submitId)) {
cocoon.redirectTo ("index"); // FAILS !!
break;
}
} // end while
} catch (e) {
cocoon.log.error (e);
cocoon.sendPage ("screen/error", {message: e});
} finally {
session.close ();
cocoon.releaseComponent (factory);
}
} else {
cocoon.sendPage ("screen/error", {message: "myalbums.album.notyours"});
}
} else {
cocoon.sendPage ("screen/error", {message: "myalbums.album.notavailable"});
}
}

Any ideas anyone?

thanks

regards Jeremy

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to