Hi Francesco,

you have to wrap the field(s) to be observed or if you use the binding observeFieldID you can only observe one field as an id must be unique on a html page. As you have a repetition and use a static id you have the very same id multiple times which is not allowed.

So either give each textfield a dynamic id and put the observefield tag inside the repetition or put the whole repetition inside the observefield tag. The latter results that all (!) form elements will trigger the observefield so if you don't want this wrap only the specific textfield with that tag.

jw


<wo:loop>
  ...
  <li class = "cprod-item-qta">
<webobject name = "qtaObserveField"><webobject name = "quantityField"/></webobject>
  </li>
  ...
</wo:loop>



Am 24.07.2009 um 10:09 schrieb Francesco Romano:

Ok.. I've some problems...
The first thing I tried is to add the ObserveField to observe one field. It works.. but... I realized that the field to be observed is inside a wo:loop.. so I removed the binding observeFieldID but now it doesn't work...

This is a piece of the html:

<webobject name = "cartUpdateContainer">  <--- the ajaxUpdateContainer
                <div id = "cart-wrapper">
                        <div id="cart-cart">
                        <ul id = "product-list">
                                <wo:form>
                                <webobject name = "qtaObserveField"/>   <--- 
the observefield
                                <wo:loop list = "$cart" item = "$anItem">
                                        
                                        <li class = "cprod-item">
                                                <div class = "cprod-container">
                                                        <div class = 
"cprod-img">
                                                                <webobject name = 
"showProductLink">
<wo:img filename = "$anItem.product.photoSrc" alt = "$anItem.product.nome" framework = "app"/>
                                                                </webobject>
                                                        </div>
                                                        
                                                        <div class = 
"cprod-info">
                                                                <ul class = 
"cprod-right-info">
                                                                        <li class = 
"cprod-item-price">
                                                                                <webobject 
name = "singleItemPrice"/>
                                                                        </li>
                                                                        <li class = 
"cprod-item-qta">
<webobject name = "quantityField"/> <--this it the field(s) to be observed
                                                                        </li>
                                                                        <li class = 
"cprod-item-total">
                                                                                        
<webobject name = "totalItemPrice"/>
                                                                        </li>
                                                                </ul>
                                                                <h4>
                                                                        <webobject name = 
"showProductLink">
                                                                                <wo:str 
value = "$anItem.product.nome"/>
                                                                        
</webobject>
                                                                </h4>
                                                                <div class = 
"cprod-admin">
<p class = "cprod-remove"><webobject name = "removeItem"/></ p>
                                                                </div>
                                                        </div>
                                                        
                                                </div>
                                        </li>
                                </wo:loop>
                                </wo:form>
                        </ul>
                        </div>
                        </div>
                        </webobject>

The wod (only the ajax-related)

quantityField: WOTextField {
        value = anItem.quantity;
        otherTagString = "size = \"3\"";
        numberformat = "0";
        //id = "qtaField";
}

removeItem: AjaxUpdateLink {
         action = removeItem;
         string = "Rimuovi";
         updateContainerID = "cartListContainer";
}

qtaObserveField: AjaxObserveField {
        //observeFieldID = "qtaField";
        action = quantityChanged;
        updateContainerID = "cartListContainer";
}


cartUpdateContainer: AjaxUpdateContainer {
        id = "cartListContainer";
}

By the way... the removeItem update link works.


Francesco

On 23/lug/09, at 19:35, Amedeo Mantica wrote:

use AjaxObserveField

Regards
Amedeo

On 23/lug/09, at 18:29, Francesco Romano wrote:

Hi.

I have a WOTextfield in a page.
I'd like to call an action if the content of the textfield changes.
I tried to insert it inside a woform but this "destroyed" my html layout, and the event is called only after the "return" button is pressed. I don't need (now, but in the future I'll add some ajax functions to the site) to do this in the "ajax-way", only to call the action.

Thanks.

Francesco



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/amedeomailing%40insigno.it

This email sent to [email protected]


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to