cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject Re: Problem getting an object out of a drop down list
Date Thu, 14 Apr 2005 11:56:52 GMT
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 "test.@3rdt" 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                                      lgawron@mobilebox.pl
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message