Hi,

The following is my code and it does not work as expected. What am I doing wrong?
This code is in this_OnBeforeDisplayEvent(...) of the page where I check if a page
session object is set (when "update cart" button is clicked this page session object is
set and the same page is reloaded).

        CSpTextBox tbQuantity = (CSpTextBox)getDisplayField ("*tbQuantity");
        CSpValue tbValue = tbQuantity.getValue ();
        if (tbValue instanceof CSpVector)
        {
                // There are multiple row values in this display field
                umCartContents cart = 
(umCartContents)CSpider.getUserSessionObject("US_SHOPPING_CART");
                CSpVector tbValueVector = (CSpVector) tbValue;
                for (int i = 0; i < tbValueVector.size (); i++)
                {
                        CSpInteger currRowValue = (CSpInteger)tbValueVector.get (i);
                        umCartItem item = cart.getCartItem(i);
                        item.setQuantity(currRowValue.intValue());
                }
                CSpider.removeUserSessionObject("US_SHOPPING_CART");
                CSpider.putUserSessionObject("US_SHOPPING_CART", cart);
        }
        else
        {
                CSpInteger val = null;
                if (tbValue != null)
                        val = new CSpInteger(tbValue.intValue());
        }

-BhaskaraReddy


[EMAIL PROTECTED] wrote:
>>Is there a requirement for the user to click a button on the
>same row as the product?
>
>If you do a getValue on "*tbOrderQty" you will get a CSpVector
>if there is more than 1 row and a CSpValue if there is a single
>row.
>
>Perhaps you could just have a single order button placed at
>the top of the quantity text box column and process the vector
>to determine which products have quantites.
>
>Submit_onWebEvent:
>
>//* for "deep search" (under repeated)
>CSpValue tVal = getDisplayFieldValue("*tbOrderQty");
>CSpVector tVec = null;
>
>if (tVal instanceof CSpVector) {
>   tVec = (CSpVector) tVal;
>   int size = tVec.size();
>
>   CSpValue iVal = null;
>
>   //process vector elements
>   for (int i=0; i<size; i++) {
>      iVal = tVec.get(i);
>      //check value
>   }
>}
>else {
>   //it's a single
>   //check value of tVal //.toString(), .intValue(), ...
>}
>
>Stanley Dang wrote:
>>Hi all,
>>
>>Please help me on the below problem if you can:
>>
>>I have a page that contains a repeated object name "Repeated1". In "Repeated1", I 
>have two static text fields named "stInv_No", "stInv_Desc" that are bound to the 
>database field. 
>>In addition, on EACH ROW, I added an unbound text box name "tbOrderQty" and a button
         named "btAddtoCart". I want the customer to enter the value in "tbOrderQty" 
and click
         the "btAddtoCart" to add the order to the shopping cart. Depending on 
whichever the
         button the customer clicked, I need to "grab" the value in "tbOrderQty" on 
the same
         row.
>>
>>*  How do I determine the row that the button was clicked from (row index)?
>>
>>*  Once I know the row index, how do I retrieve a value from an unbound field, 
>"tbOrderQty", within a repeated object? 
>>
>>Thanks for your help in advance,
>>
>>Stanley Dang
>>AIM Management Group, Inc.
>>Voice:        (713) 214-7321
>>Pager:        (800) 672-4363
>>Email:        [EMAIL PROTECTED]
>>
>>
>

_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to