Here is the code related to my AjaxFormLoop which works (besides a few
non T5 related persistance issues in my own code ;-)

        
        
        ******************* java file **************
        
        @Property
        @Persist
        private List<AjaxFormLoopEntityHolder<ContactDetail>> details;

        @Property
        private AjaxFormLoopEntityHolder<ContactDetail> contactDetailRow;
        
        @Component(id = "contactDetailsAjaxLoop", parameters = 
{"source=details",
                                                                                
                                "value=contactDetailRow",
                                                                                
                                "addRow=block:addRowBlock",
                                                                                
                                "encoder=contactDetailEncoder"})
        private AjaxFormLoop contactDetailsAjaxLoop;
        
        @Component(id = "contactDetailForm", parameters =
{"zone=contactDetailsZone", "context=legalEntity.id"})
        private Form contactDetailForm;

        @Component(id = "addRowLink", parameters = {"context=legalEntity.id"})
        private AddRowLink addRowLink;
        
        
        @Component(id = "contactDetailsSubmit", parameters =
{"value=message:jsportal.controls.save"})
        private Submit contactDetailsSubmit;
        
        @Inject
        @Property
        private Block addRowBlock;
        
        @OnEvent(value=EventConstants.ADD_ROW)
                        private Object handleAddRow() throws Exception {
                                this.setEdit(true);

                                ContactDetail contactDetail = new 
ContactDetail();
                                contactDetail.setState(State.ACTIVE);
                                AjaxFormLoopEntityHolder detail = new
AjaxFormLoopEntityHolder<ContactDetail>(contactDetail, true, 0 -
System.currentTimeMillis());
                                details.add(detail);

                                return detail;
        }

        @OnEvent(value=EventConstants.REMOVE_ROW)
        private void handleRemoveRow(AjaxFormLoopEntityHolder detail) throws 
Exception{
                                for(AjaxFormLoopEntityHolder<ContactDetail> 
holder : details) {
                                        if(detail.getKey() == holder.getKey()) {
                                                detail.setDeleted(true);
                                        }
                                }
        }
        
        @OnEvent(component = "contactDetailForm", value =
EventConstants.PREPARE_FOR_SUBMIT)
                private void handleContactDetailPrepare(Long legalEntityId) 
throws Exception {
                        loadLegalEntity(legalEntityId);
                }

                private void loadLegalEntity(Long legalEntityId) throws 
Exception {
                        LegalEntityService service =
serviceProvider.getService(LegalEntityService.class);
                        legalEntity = (LegalEntity) 
service.get(LegalEntity.class, legalEntityId);
                }

                @OnEvent(component = "contactDetailForm", value = 
EventConstants.SUCCESS)
                private Object handleContactDetailSave() throws Exception {

                        //do the persisting
                }


**************** AjaxFormLoopEntityHolder ******************

package com.joostschouten.common.http.tapestrybase.model;

public class AjaxFormLoopEntityHolder<T> {
        
                private T entity;
                private Long key;
                private boolean newEntity = false;
                private boolean deleted = false;

                public AjaxFormLoopEntityHolder(T entity, boolean newEntity, 
Long key) {
                        this.entity = entity;
                        this.newEntity = newEntity;
                        this.key = key;
                }

                public T getEntity() {
                        return entity;
                }
                
                public void setEntity(T entity) {
                        this.entity = entity;
                }

                public Long getKey() {
                        return key;
                }

                public boolean isNew() {
                        return newEntity;
                }

                public boolean setDeleted(boolean deleted) {
                        return this.deleted = deleted;
                }

                public boolean isDeleted() {
                        return deleted;
                }

}
                        
                        
        ******************* The tml file ***********************
                        
                        
                        <form t:id="contactDetailForm">

                                                <div class="entityDetails">
                                                        <div 
t:id="contactDetailsAjaxLoop">
                                                                <t:delegate 
to="detailBlock"/>
                                                        </div>

                                                </div>

                                                <ol class="formControls">
                                                        <li class="next">
                                                                <input 
t:id="contactDetailsSubmit"
t:value="message:jsportal.controls.save"/>
                                                        </li>
                                                </ol>

                                        </form>
                                </t:block>

                                <t:block t:id="detailBlock">
                                        <div t:id="loopContactDetail">the form 
fields, in my case they
come from a seperate component</div>
                                </t:block>

                                <t:block id="addRowBlock">
                                        <div class="formControls">
                                                <div class="next">
                                                        <a 
t:id="addRowLink">${message:components.entities.EntitiesContactDetails.addNewContactInfo}</a>
                                                </div>
                                        </div>
                                </t:block>

I hope this is of use to you.

Cheers,
Joost

On Tue, Apr 28, 2009 at 6:15 PM, zack1403 <zack.mann...@gmail.com> wrote:
>
> Hmm, the jumpstart example you gave uses t:submitnotifier as well as all
> examples (even nightly docs).  The example you gave is running on 5.0.18.
> You are sure that example works on upgrade to 5.1.0.2? Even at the simplest
> form I am still getting my exception.  The simplest possible form I could
> get down to is in my first post (page, tml, and exception).  This is
> happening application-wide once I upgraded so it must be something that has
> changed internal to tapestry.  Is there a new way to use AjaxFormLoop that I
> am missing.  Does onAddRow still return an Object?
>
> Zack
>
>
> Joost Schouten (mailing lists) wrote:
>>
>> The example at
>> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/tables/ajaxformloop1
>> which I used as a guide worked well for me on 5.1.0.3.
>>
>> In your examples you use the t:submitnotifier. I never really used it
>> but maybe you do some DOM alterations in those event methods that
>> Tapestry doesn't like.
>>
>> Cheers,
>> Joost
>>
>> On Tue, Apr 28, 2009 at 3:59 PM, zack1403 <zack.mann...@gmail.com> wrote:
>>>
>>> Hey I hate to bump but this is a huge blocker for me.  Is there more
>>> information I can give to try and help troubleshoot??
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23269752.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23270804.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to