Hi Ugo!

Apparently Cocoon eats my request parameters (see below).

On Mar 10, 2004, at 12:13 AM, Ugo Cei wrote:

Mark Lundquist wrote:
I have a small non-Woody form, containing a control like this:
<input type="hidden" name="submitAction" value="whatever" />
In my 2.1.3 flowscript, after sendPageAndWait() I interrogate cocoon.request.submitAction.
In 2.1.4, cocoon.request.submitAction evaluates to 'undefined'. No luck with cocoon.request['submitAction'], either. If I change it to cocoon.request.get ("submitAction"), that evaluates to null. Same if I use getParameter().
aaaaack! What am I doing wrong!?

Nothing, apparently. "cocoon.request.submitAction" should work. Make sure that the parameter is actually sent by the browser. Either use a GET action for your form and examine the URI or use something like Mozilla LiveHTTPHeaders to have a look at the real contents of your request.

Well OK, as a sanity check I used LiveHTTPHeaders in Moz. Here's the request:

ahh, never mind, for some reason I cannot copy text out of the LiveHTTPHeaders window (problem on OS X? Who knows...). I'm not gonna type it all in, but I can tell you that everything looks perfect in the request — in particular, all the parameters are there with the expected values.

Here's my flowscript, with some instrumentation included (starting with the call to getParamaterNames() ):

function logoPopup() {
var logoUploadManager = cocoon.session['logoUploadManager'];
logoUploadManager.reset();
var logoURI = logoUploadManager.logoURI() + ".upload";


while (true) {
cocoon.log.info (logoUploadManager.getState());
cocoon.sendPageAndWait (
"Profile/logo-popup.display",
{
"logoURI": logoURI,
"logoState": logoUploadManager.getState()
}
);


var paramNames = cocoon.request.getParameterNames();


// This prints "java.util.Collections$6" !?
//
print (paramNames.getClass().getName());


// But paramNames acts like an Enumeration, as advertised..
// ... an empty one, unfortunately. This prints nothing!
//
while (paramNames.hasMoreElements()) {
print (paramNames.nextElement());
}

switch (cocoon.request.getParameter("submitAction")) {
case "upload" :
var source = cocoon.request.get("logo-file");
logoUploadManager.upload (source);
break;
case "save" :
logoUploadManager.saveLogo();
}
}
}

I am just stumped... what in the heck happened to my parameters? Cocoon ate them! Waaaa! Give them back, Cocoon!

Other POST requests are handled fine. The only difference I can think of is the different Content-Type: this one is multipart/form, while the others are application/x-www-form-urlencoded.

~ Mark

Reply via email to