beyanet.com wrote:
beyanet.com wrote:
Ok,
let me explain. I have a html page which presents a selection of
previous orders made by a client. In the option value section I place
the associated order objects of a user like so:
<jx:forEach var="orderz" items="${userGlobal.getUserOrders()}">
<option value="${orderz}">${orderz.getOrderDate()}</option>
</jx:forEach>
Leszek,
thanks for your reply but allow me to explain more effectively my problem.
1. A user logs in and as part of that process the users personal
details, orders and related orderitems are stored in userGlobal object.
2. So doing the following in my jx file will give me access, so I
thought, to the order and subsequent order items I want:
<jx:forEach var="orderz" items="${userGlobal.getUserOrders()}">
<option name="order"
value="${orderz.getID()}">${orderz.getOrderDate()}</option> </jx:forEach>
3. The main selection line reads as:
<select name="old_orders"
onchange="popup3(this.form.old_orders.options[this.form.old_orders.selectedIndex].value)">
<code from jx file>
</select>
So when a user makes a selection it automatically passes the value of
the selection to another function whereby I access the value as :
var oldorder = cocoon.parameters.oldOrder;
At this point the value of old_order is "[EMAIL PROTECTED]" but I need it as an
object. Your solution which I had already implemented:
var order = resolverOrderById( orderId );
meant that I would have to interrogate the database again and access the
order object based on the order id passed to it. But I already have all
the orders and associated order items for each order held in userGlobal
object when the user logs in.
4. If the old_order was an object I would then do:
cocoon.sendPage("view_oldOrders2",{"oldorder":oldorder});
and in this jx file then access the orderitems as follows:
${oldorder.getOrderItems().getPrice()} etc etc...
Any ideas?
You cannot place your domain objects into html file. Clearly impossible.
Either store all object's data in some kind of hidden <div/> tag and
show it when necessary or hit the server again.
--
Leszek Gawron [EMAIL PROTECTED]
IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]