beyaRecords wrote:
<fd:javascript>
for (var orderitem in neworder.getOrderItems()){ <---------- This line is fine.
if (orderitem.getStock().getItemTitle() == "abcd") { <----- This line is causing the error.
...do something.....
}
}
</fd:javascript>
The code in the jx page works, but the javascript in the xml file gives the above mentioned error message. What am I missing here?
In javascript, the for/in loop is for iterating over the properties of an object, not over a collection. So if the return type of getOrderItems() is a list, you'll actually be iterating over the properties of the list, rather than it's contents. If you rewrite the loop as
var orderitems = neworder.getOrderItems();
for (var i = 0; i < orderitems.size(); i++) {
var orderitem = orderitems.get(i);
if (orderitem.getStock().getItemTitle() == "abcd") {
... do something.....
}
}then it should work for you.
Vil.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
