cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Markus <t.mar...@proventis.net>
Subject Re: Can't use switch with cocoon.request.get in flowscript [SOLUTION]
Date Tue, 09 Feb 2010 10:15:33 GMT
hi,

use an type conversion (to javascript string) instead of string concat:

switch (String(cmd)) {
    ...
}

regards
Thomas

> <snip>
>
> function testSwitch() {
> 	var cmd = getCmd("cmd");
> 	switch(cmd) {
> 	    case "save": 
> 		    print("request parameter was save");
> 		    break;
> 	    case "delete": 
> 		    print("request parameter was delete");
> 		    break;
> 		default:
> 		    print("request parameter was none of the above");
> 		    break;			
> 	}
> }
>
>
> function getCmd(name) {
> 	return "" + cocoon.request.getParameter(name);  // --> we need to make sure we get
a native javascript object so our switch will work
> }


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


Mime
View raw message