hi all:

I've hit a bit of a snag in trying to wrap up my petstore app, and it
has to do with my cart implementation.

the cart form looks like:

<form name="cart" action="${v SUBMISSION:FORM:submit/}" method="post">
${v SUBMISSION:PARAMS:submit}${/v}
   <div>
       <div style="background-color: rgb(152,157,165); font-family:
'Lucida Grande',Geneva,Arial,Verdana,sans-serif; font-style: normal;
font-variant: normal; font-size: 11px; line-height: normal;
font-size-adjust: none; font-stretch: normal; font-weight: bold;">
           <div style="float:left; text-align:left; width:52%;">Cart
Items</div>
           <div style="float:left; text-align:left; width:16%;">Quantity</div>
           <div style="float:left; text-align:right; width:16%;">Item
Price</div>
           <div style="float:left; text-align:right; width:16%;">Item
Total</div>
       </div>
       <div>
       ${v items}${/v}
       </div>
   </div>

   <div style="clear:both;">
            <div style="border-top: 1px solid rgb(152, 157, 165); margin: 
6px;"></div>
       <div>
                        <div style="float:right;"><span style="font-weight: 
bold;">Cart
Subtotal:</span>${v subtotal}${/v}</div>
       </div>
       <br /><br />
       <div>
           <div style="float:right">
               <input name="update"
src="img/buttonorgupdatesubtotal.gif" type="image"><br>
           </div>
       </div>
        </div>            
</form>

The items v placeholder is where your cart items are appended; they look like:

<div class="CartItem" style="clear:both">
        <div style="float:left; text-align:left; width:52%;">
                <div style="font-weight: bold;">
                ${v description}${/v}
                </div>
                <div style="padding-left: 10px; font-weight: bold; color: 
#555555;">
                        Extra Info
                </div>

                <div style="padding-left: 10px;">
                </div>
                <div style="padding-top: 4px">
                        Estimated Ship: Within 24 hours (In-Stock)
                </div>
        </div>
        <div style="float:left; text-align:left; width:16%;">
                <div class="form_field" id="${v id/}">
                        <div>
                                <div ${v MARK:quantity}${/v}>
                                        ${v ERRORS:quantity}${/v}
                                        ${v FORM:INPUT:quantity}id="test" 
style="text-align: right;"
maxlength="3" size="3"${/v}
                                </div>
                        </div>
                </div>

                <a href="${v EXIT:QUERY:cart/}remove/${v itemId/}">Remove</a>
        </div>
        <div style="float:left; text-align:right; width:16%;">${v 
listPrice}${/v}</div>
        <div style="float:left; text-align:right; width:16%;">${v 
total}${/v}</div>       
</div>


Now, these all work quite well; items can be added (increased if
already added),removed etc... cart items are added to the database,
and re-rendered when there's a change to the cart. All those are
dandy.

My current problem has to do with updating the cart (after a user
changes the quantity in the text box provided)

1// how do i locate which bean a particular quantity maps to when the
form is submitted;
1.1// changing the form method to a GET, with 2 items in the cart (one
with qty 1, the other with 4), i get a submission uri that looks like:
http://localhost:8080/$%7Bv%20SUBMISSION:FORM:submit/%7D?quantity=1&quantity=4&update.x=34&update.y=17

2// is there a way to use the id of the input with form submissions
2.1//rife doesn't seem to allow nested value tags.. ideally, i wanted
to use the id of the cartitem as it's id. so, it would have been nice
to be ablel to do:
${v FORM:INPUT:quantity}id="${v id/}" style="text-align: right;"
maxlength="3" size="3"${/v}, but rife barfs at this.


Thanks,
Emmanuel

--
Benjamin Disraeli - "Nurture your minds with great thoughts. To
believe in the heroic makes heroes."
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to