I found a way.. not sure how hacky this is or if there is a better way...
If tickets.length fails.. it returns undefined not null...
In javascript (flowscript) this should be if (typeof(tickets.length) == 'undefined') { // handle one value }
which may be a little cleaner.
Geoff
function postInvoice() { var tickets = cocoon.request.get("tickets[]"); if(tickets != null) { var s = "tickets.id IN (";
if(tickets.length) { s = s + "'" + tickets + "'"; } else { tickets = tickets.toArray(); for (var i = 0; i < tickets.length; i++) { tickets[i] = "'" + tickets[i] + "'"; if (i != "0") { s = s + "," + tickets[i]; } else { s = s + tickets[i]; } } }
var s = s + ")"; cocoon.request.setAttribute("sql", s); cocoon.sendPage("postInvoice.xsp"); } else { cocoon.request.setAttribute("error", "Please Select Some Tickets."); cocoon.sendPage("failure.xsp"); } }
JD
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
