You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by zack1403 <za...@gmail.com> on 2009/04/22 20:52:45 UTC

AjaxFormLoop Exception on 5.1.0.2 upgrade

When I upgraded to 5.1.0.2 my AjaxFormLoops throw exceptions upon trying to
add a row.  Remove row links still work and the transaction is getting
committed even when there is an exception.  Ie, if I refresh the page after
blackbird shows the exception I can see my added row.  I have trimmed down
my code to the simplest possible AjaxFormLoop example and an exception is
still being thrown.  Should I be returning something other than an Object
from my onAddRow method?

Exception:

[ERROR] 35:15
(DefaultRequestExceptionHandler.java:handleRequestException:62) Processing
of request failed with uncaught exception: The rendered content did not
include any elements that allow for the positioning of the hidden form
field's element.
java.lang.IllegalStateException: The rendered content did not include any
elements that allow for the positioning of the hidden form field's element.
	at
org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.getElement(HiddenFieldPositioner.java:74)
	at
org.apache.tapestry5.corelib.components.FormInjector$1.renderMarkup(FormInjector.java:234)
	at
org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
	at
org.apache.tapestry5.corelib.components.AjaxFormLoop$10.renderMarkup(AjaxFormLoop.java:415)
	at
org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
	at
org.apache.tapestry5.internal.services.PageRenderQueueImpl.renderPartial(PageRenderQueueImpl.java:159)

Page class snippet: 

   @CommitAfter
    public Comparison onAddRow() {
	return new Comparison();
    }

Template snippet:
<t:ajaxformloop source="comparisons" value="currentcomparison"
encoder="comparisonsencoder">
	<t:parameter name="addRow">
		<t:addrowlink>Add a Comparison</t:addrowlink>
	</t:parameter>
	<t:submitnotifier>
		<t:removerowlink>Remove</t:removerowlink>
	</t:submitnotifier>
</t:ajaxformloop>

Any help would be much appreciated.
-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23175801.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
I trimmed my source down to the simplest form trying to isolate the issue.  I
pasted in the simplest form I could get to.  My original contains a number
of elements including a bean edit form:

<t:submitnotifier>
	<div t:type="beaneditor" t:id="currentcomparison" />
	<t:removerowlink>Remove</t:removerowlink>
</t:submitnotifier>

It yields the same exception.  There were many more elements in there when
the exception was first thrown.  Tried to trim out any mistake I might be
making and was left with the most basic AjaxFormLoop.  

Zack


Howard Lewis Ship wrote:
> 
> <t:ajaxformloop source="comparisons" value="currentcomparison"
> encoder="comparisonsencoder">
>        <t:parameter name="addRow">
>                <t:addrowlink>Add a Comparison</t:addrowlink>
>        </t:parameter>
>        <t:submitnotifier>
>                <t:removerowlink>Remove</t:removerowlink>
>        </t:submitnotifier>
> </t:ajaxformloop>
> 
> Shouldn't there be a TextField or something in there?
> 
> The rather odd error is that Tapestry has to "hunt around" to find a
> conforming location to add a hidden field; typically inside a <p> or
> before an <input> tag. Your AjaxFormLoop has, effectively, no body and
> so no content gets written, and Tapestry can't figure out where to add
> the hidden field.
> 
> On Wed, Apr 22, 2009 at 11:52 AM, zack1403 <za...@gmail.com> wrote:
>>
>> When I upgraded to 5.1.0.2 my AjaxFormLoops throw exceptions upon trying
>> to
>> add a row.  Remove row links still work and the transaction is getting
>> committed even when there is an exception.  Ie, if I refresh the page
>> after
>> blackbird shows the exception I can see my added row.  I have trimmed
>> down
>> my code to the simplest possible AjaxFormLoop example and an exception is
>> still being thrown.  Should I be returning something other than an Object
>> from my onAddRow method?
>>
>> Exception:
>>
>> [ERROR] 35:15
>> (DefaultRequestExceptionHandler.java:handleRequestException:62)
>> Processing
>> of request failed with uncaught exception: The rendered content did not
>> include any elements that allow for the positioning of the hidden form
>> field's element.
>> java.lang.IllegalStateException: The rendered content did not include any
>> elements that allow for the positioning of the hidden form field's
>> element.
>>        at
>> org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.getElement(HiddenFieldPositioner.java:74)
>>        at
>> org.apache.tapestry5.corelib.components.FormInjector$1.renderMarkup(FormInjector.java:234)
>>        at
>> org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
>>        at
>> org.apache.tapestry5.corelib.components.AjaxFormLoop$10.renderMarkup(AjaxFormLoop.java:415)
>>        at
>> org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
>>        at
>> org.apache.tapestry5.internal.services.PageRenderQueueImpl.renderPartial(PageRenderQueueImpl.java:159)
>>
>> Page class snippet:
>>
>>   @CommitAfter
>>    public Comparison onAddRow() {
>>        return new Comparison();
>>    }
>>
>> Template snippet:
>> <t:ajaxformloop source="comparisons" value="currentcomparison"
>> encoder="comparisonsencoder">
>>        <t:parameter name="addRow">
>>                <t:addrowlink>Add a Comparison</t:addrowlink>
>>        </t:parameter>
>>        <t:submitnotifier>
>>                <t:removerowlink>Remove</t:removerowlink>
>>        </t:submitnotifier>
>> </t:ajaxformloop>
>>
>> Any help would be much appreciated.
>> --
>> View this message in context:
>> http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23175801.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> Director of Open Source Technology at Formos
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23187859.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by Howard Lewis Ship <hl...@gmail.com>.
<t:ajaxformloop source="comparisons" value="currentcomparison"
encoder="comparisonsencoder">
       <t:parameter name="addRow">
               <t:addrowlink>Add a Comparison</t:addrowlink>
       </t:parameter>
       <t:submitnotifier>
               <t:removerowlink>Remove</t:removerowlink>
       </t:submitnotifier>
</t:ajaxformloop>

Shouldn't there be a TextField or something in there?

The rather odd error is that Tapestry has to "hunt around" to find a
conforming location to add a hidden field; typically inside a <p> or
before an <input> tag. Your AjaxFormLoop has, effectively, no body and
so no content gets written, and Tapestry can't figure out where to add
the hidden field.

On Wed, Apr 22, 2009 at 11:52 AM, zack1403 <za...@gmail.com> wrote:
>
> When I upgraded to 5.1.0.2 my AjaxFormLoops throw exceptions upon trying to
> add a row.  Remove row links still work and the transaction is getting
> committed even when there is an exception.  Ie, if I refresh the page after
> blackbird shows the exception I can see my added row.  I have trimmed down
> my code to the simplest possible AjaxFormLoop example and an exception is
> still being thrown.  Should I be returning something other than an Object
> from my onAddRow method?
>
> Exception:
>
> [ERROR] 35:15
> (DefaultRequestExceptionHandler.java:handleRequestException:62) Processing
> of request failed with uncaught exception: The rendered content did not
> include any elements that allow for the positioning of the hidden form
> field's element.
> java.lang.IllegalStateException: The rendered content did not include any
> elements that allow for the positioning of the hidden form field's element.
>        at
> org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.getElement(HiddenFieldPositioner.java:74)
>        at
> org.apache.tapestry5.corelib.components.FormInjector$1.renderMarkup(FormInjector.java:234)
>        at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
>        at
> org.apache.tapestry5.corelib.components.AjaxFormLoop$10.renderMarkup(AjaxFormLoop.java:415)
>        at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
>        at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl.renderPartial(PageRenderQueueImpl.java:159)
>
> Page class snippet:
>
>   @CommitAfter
>    public Comparison onAddRow() {
>        return new Comparison();
>    }
>
> Template snippet:
> <t:ajaxformloop source="comparisons" value="currentcomparison"
> encoder="comparisonsencoder">
>        <t:parameter name="addRow">
>                <t:addrowlink>Add a Comparison</t:addrowlink>
>        </t:parameter>
>        <t:submitnotifier>
>                <t:removerowlink>Remove</t:removerowlink>
>        </t:submitnotifier>
> </t:ajaxformloop>
>
> Any help would be much appreciated.
> --
> View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23175801.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sun, 07 Mar 2010 15:12:49 -0300, wdahu <wd...@o2.pl> wrote:

> I solved this problem. It is not caused by
> org.apache.tapestry5.services.ComponentSource.getPage(pageName) in my
> Dispatcher only by the argument of this method.
> I used the example from
> http://wiki.apache.org/tapestry/Tapestry5HowToControlAccess and there is

Use the decode* methods from ComponentEventLinkEncoder to get the name of  
the requested page.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by wdahu <wd...@o2.pl>.
I solved this problem. It is not caused by
org.apache.tapestry5.services.ComponentSource.getPage(pageName) in my
Dispatcher only by the argument of this method.
I used the example from
http://wiki.apache.org/tapestry/Tapestry5HowToControlAccess and there is
    int nextslashx = path.length();
    String pageName;
    while (true)
    {
      pageName = path.substring(1, nextslashx);
      if (!pageName.endsWith("/") && resolver.isPageName(pageName)) break;
      nextslashx = path.lastIndexOf('/', nextslashx - 1);
      if (nextslashx <= 1) return false;
    }

And the problem is to determine the pagename. If the name does not end with
"/" it does not detect the correct page name. Should be improved so that the
end of the page name is also ".". 

 int nextslashx = path.length();
        int next1,next2;
        String pageName;

         while (true) {
            pageName = path.substring(1, nextslashx);
            if ((!pageName.endsWith("/")||!pageName.endsWith(".") )&&
resolver.isPageName(pageName)) {
                break;
            }
            next1 = path.lastIndexOf('/', nextslashx - 1);
            next2 = path.lastIndexOf('.', nextslashx - 1);
            nextslashx=(next1>next2)?next1:next2;
            if (nextslashx <= 1) {
                return false;
            }
        }

-- 
View this message in context: http://old.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p27813311.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by wdahu <wd...@o2.pl>.
I have the same problem. I noticed that it occurs when I invoke method
org.apache.tapestry5.services.ComponentSource.getPage (pageName) in my
Dispatcher.
If someone has already solved this problem?
-- 
View this message in context: http://old.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p27806708.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
Knowing that that simple example worked for everyone, I started hacking away
at my app module.  Finally narrowed down what was causing the issue:

   public void contributeMasterDispatcher(OrderedConfiguration<Dispatcher>
configuration, @InjectService("AuthDispatcher") Dispatcher authDispatcher) {
     configuration.add("AuthDispatcher", authDispatcher,
"before:PageRender");
     }

In this case, the error sure didn't help the situation at all.  I am pretty
sure I am adding my dispatcher correctly as it performs as expected
everywhere else.  For some reason it is messing with ajaxformloop.  Tested
my other ajaxformloops and they all work after commenting out these few
lines.  I guess I'm on to another issue of why this is causing issues :(

Really, thanks again for everyones help.  This error does sound like
something that is being misreported as it is unrelated to the actual cause.
Maybe a bug?

Zack


Ulrich Stärk wrote:
> 
> Your exact same code is working fine using 5.1.0.5-SNAPSHOT on Jetty 
> 6.1.6 run from inside Eclipse. Could you elaborate on your environment? 
> Also give removing and reinstalling all libs a try and make sure that 
> there aren't multiple versions of the same lib in your classpath.
> 
> Uli
> 
> 

-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23301366.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
Well the thing is that its reproducible when I deploy on my staging server to
tomcat 6 from the generated war file.  As well as locally with jetty 6.1.6. 
I am using the maven plugin to run goal jetty:run locally.

Zack

Ulrich Stärk wrote:
> 
> Your exact same code is working fine using 5.1.0.5-SNAPSHOT on Jetty 
> 6.1.6 run from inside Eclipse. Could you elaborate on your environment? 
> Also give removing and reinstalling all libs a try and make sure that 
> there aren't multiple versions of the same lib in your classpath.
> 
> Uli
> 

-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23297560.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by Ulrich Stärk <ul...@spielviel.de>.
Your exact same code is working fine using 5.1.0.5-SNAPSHOT on Jetty 
6.1.6 run from inside Eclipse. Could you elaborate on your environment? 
Also give removing and reinstalling all libs a try and make sure that 
there aren't multiple versions of the same lib in your classpath.

Uli


Am 29.04.2009 08:56 schrieb zack1403:
> Alright this is the simplest setup I could do.  This is way simpler than even
> the example thats in the nightly docs.  I am getting the same error.  If
> someone could please help me out as to what I am missing here I would be
> eternally grateful.  This is the complete source, there is no other source
> involved in this except what I am pasting.
> 
> Tml:
> 
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> 
> 	<t:form>
> 		<t:ajaxformloop source="strings" value="currentString">
> 			<t:textfield t:id="thefield" value="currentString"/>
> 			<t:removeRowLink>Bye!</t:removeRowLink>
> 		</t:ajaxformloop>
> 	</t:form>
> 
> </html>
> 
> Page:
> 
> import java.util.ArrayList;
> import java.util.List;
> 
> import org.apache.tapestry5.annotations.Component;
> import org.apache.tapestry5.annotations.Property;
> import org.apache.tapestry5.corelib.components.TextField;
> 
> public class Test {
> 
>     @Property
>     private List<String> strings;
> 
>     @Property
>     private String currentString;
> 
>     @Component
>     private TextField theField;
> 
>     void onActivate() {
> 	strings = new ArrayList<String>();
> 	strings.add("Hello");
> 	strings.add("Heres a tester");
>     }
> 
>     String onAddRow() {
> 	return "Added!";
>     }
> 
>     void onRemoveRow(String toRemove) {
> 	strings.remove(toRemove);
>     }
> }
> 
> Sorry to be posting so much, I've just been pulling out my hair on this and
> (as I'm sure you all understand) we have a very tight deadline to meet. 
> Thank you all again for all the help!
> 
> Zack


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by DH <ni...@gmail.com>.
Hi, Zack

I just tried your example, but nothing wrong. Mine is 5.1.0.3.

DH
----- Original Message ----- 
From: "zack1403" <za...@gmail.com>
To: <us...@tapestry.apache.org>
Sent: Wednesday, April 29, 2009 2:56 PM
Subject: Re: AjaxFormLoop Exception on 5.1.0.2 upgrade


> 
> Alright this is the simplest setup I could do.  This is way simpler than even
> the example thats in the nightly docs.  I am getting the same error.  If
> someone could please help me out as to what I am missing here I would be
> eternally grateful.  This is the complete source, there is no other source
> involved in this except what I am pasting.
> 
> Tml:
> 
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> 
> <t:form>
> <t:ajaxformloop source="strings" value="currentString">
> <t:textfield t:id="thefield" value="currentString"/>
> <t:removeRowLink>Bye!</t:removeRowLink>
> </t:ajaxformloop>
> </t:form>
> 
> </html>
> 
> Page:
> 
> import java.util.ArrayList;
> import java.util.List;
> 
> import org.apache.tapestry5.annotations.Component;
> import org.apache.tapestry5.annotations.Property;
> import org.apache.tapestry5.corelib.components.TextField;
> 
> public class Test {
> 
>    @Property
>    private List<String> strings;
> 
>    @Property
>    private String currentString;
> 
>    @Component
>    private TextField theField;
> 
>    void onActivate() {
> strings = new ArrayList<String>();
> strings.add("Hello");
> strings.add("Heres a tester");
>    }
> 
>    String onAddRow() {
> return "Added!";
>    }
> 
>    void onRemoveRow(String toRemove) {
> strings.remove(toRemove);
>    }
> }
> 
> Sorry to be posting so much, I've just been pulling out my hair on this and
> (as I'm sure you all understand) we have a very tight deadline to meet. 
> Thank you all again for all the help!
> 
> Zack
> -- 
> View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23291616.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>

Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
Alright this is the simplest setup I could do.  This is way simpler than even
the example thats in the nightly docs.  I am getting the same error.  If
someone could please help me out as to what I am missing here I would be
eternally grateful.  This is the complete source, there is no other source
involved in this except what I am pasting.

Tml:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

	<t:form>
		<t:ajaxformloop source="strings" value="currentString">
			<t:textfield t:id="thefield" value="currentString"/>
			<t:removeRowLink>Bye!</t:removeRowLink>
		</t:ajaxformloop>
	</t:form>

</html>

Page:

import java.util.ArrayList;
import java.util.List;

import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.TextField;

public class Test {

    @Property
    private List<String> strings;

    @Property
    private String currentString;

    @Component
    private TextField theField;

    void onActivate() {
	strings = new ArrayList<String>();
	strings.add("Hello");
	strings.add("Heres a tester");
    }

    String onAddRow() {
	return "Added!";
    }

    void onRemoveRow(String toRemove) {
	strings.remove(toRemove);
    }
}

Sorry to be posting so much, I've just been pulling out my hair on this and
(as I'm sure you all understand) we have a very tight deadline to meet. 
Thank you all again for all the help!

Zack
-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23291616.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
Upgraded to 5.1.0.3 with same result.  I also removed any hibernate entities
whatsoever.  I made an AjaxFormLoop of Strings and I get the same result. 
Has anyone out there ever gotten this error in any context???? I just cant
believe I am the only one having these issues, seeing as how even the
simplest use does not work.

Zack


Joost Schouten (mailing lists) wrote:
> 
> I'm using 5.1.0.3
> 
> On Tue, Apr 28, 2009 at 7:27 PM, zack1403 <za...@gmail.com> wrote:
>>
>> Joost,
>>
>> Are you using this code on >5.1.0.2?
>>
>> Zack
>>
>>
>> Joost Schouten (mailing lists) wrote:
>>>
>>> Here is the code related to my AjaxFormLoop which works (besides a few
>>> non T5 related persistance issues in my own code ;-)
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23271622.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23283509.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by "Joost Schouten (mailing lists)" <jo...@jsportal.com>.
I'm using 5.1.0.3

On Tue, Apr 28, 2009 at 7:27 PM, zack1403 <za...@gmail.com> wrote:
>
> Joost,
>
> Are you using this code on >5.1.0.2?
>
> Zack
>
>
> Joost Schouten (mailing lists) wrote:
>>
>> Here is the code related to my AjaxFormLoop which works (besides a few
>> non T5 related persistance issues in my own code ;-)
>>
>>
>
> --
> View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23271622.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
Joost,

Are you using this code on >5.1.0.2?

Zack


Joost Schouten (mailing lists) wrote:
> 
> Here is the code related to my AjaxFormLoop which works (besides a few
> non T5 related persistance issues in my own code ;-)
> 
> 

-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23271622.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by "Joost Schouten (mailing lists)" <jo...@jsportal.com>.
in my case onAddRow will not do any persisting. I will only persist
the added row once the user saves the whole form. Also, I use my own
transaction handling which is all done in a filter outside Tapestry.
So any exception will actually roll back the transaction.

The fact that I don't use any of the Tapestry hibernate/transaction
stuff might cause a substantial difference.

Cheers,
Joost

On Tue, Apr 28, 2009 at 6:59 PM, zack1403 <za...@gmail.com> wrote:
>
> Thanks Joost! While I'm sorting through that to find out what youre doing
> that I am missing, here is a question.  When my onAddRow event is throwing
> an exception, shouldn't the transaction be rolled back? I would think that
> is expected behavior but the transaction is being committed. When I refresh
> the page the row is there. Is there a reason that isnt consistent with the
> rest of tapestry transactions?
>
> Zack
>
>
> Joost Schouten (mailing lists) wrote:
>>
>> sorry, I forgot the encoder for the AjaxFormLoop:
>>
>> public ValueEncoder<AjaxFormLoopEntityHolder<ContactDetail>>
>> getContactDetailEncoder() {
>>
>>               final LegalEntityService service =
>> serviceProvider.getService(LegalEntityService.class);
>>
>>               return new ValueEncoder<AjaxFormLoopEntityHolder<ContactDetail>>() {
>>
>>                       public String toClient(AjaxFormLoopEntityHolder<ContactDetail> detail)
>> {
>>                               return detail.getKey().toString();
>>                       }
>>
>>                       public AjaxFormLoopEntityHolder<ContactDetail> toValue(String detailId)
>> {
>>
>>                               AjaxFormLoopEntityHolder<ContactDetail> ret = null;
>>
>>                               Long detailKey = Long.parseLong(detailId);
>>
>>                               for(AjaxFormLoopEntityHolder<ContactDetail> holder : details) {
>>                                       if(detailKey.equals(holder.getKey())) {
>>                                               ret = holder;
>>                                               break;
>>                                       }
>>                               }
>>
>>                               return ret;
>>
>>                       }
>>               };
>>       }
>>
>> On Tue, Apr 28, 2009 at 6:45 PM, Joost Schouten (mailing lists)
>> <jo...@jsportal.com> wrote:
>>> 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">
>>>
>>> ${message:components.entities.EntitiesContactDetails.addNewContactInfo}
>>>                                                </div>
>>>                                        </div>
>>>                                </t:block>
>>>
>>> I hope this is of use to you.
>>>
>>> Cheers,
>>> Joost
>>>
>>> On Tue, Apr 28, 2009 at 6:15 PM, zack1403 <za...@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 <za...@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-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23271251.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
Thanks Joost! While I'm sorting through that to find out what youre doing
that I am missing, here is a question.  When my onAddRow event is throwing
an exception, shouldn't the transaction be rolled back? I would think that
is expected behavior but the transaction is being committed. When I refresh
the page the row is there. Is there a reason that isnt consistent with the
rest of tapestry transactions?

Zack


Joost Schouten (mailing lists) wrote:
> 
> sorry, I forgot the encoder for the AjaxFormLoop:
> 
> public ValueEncoder<AjaxFormLoopEntityHolder<ContactDetail>>
> getContactDetailEncoder() {
> 		
> 		final LegalEntityService service =
> serviceProvider.getService(LegalEntityService.class);
> 		
> 		return new ValueEncoder<AjaxFormLoopEntityHolder<ContactDetail>>() {
> 
> 			public String toClient(AjaxFormLoopEntityHolder<ContactDetail> detail)
> {
> 				return detail.getKey().toString();
> 			}
> 
> 			public AjaxFormLoopEntityHolder<ContactDetail> toValue(String detailId)
> {
> 				
> 				AjaxFormLoopEntityHolder<ContactDetail> ret = null;
> 				
> 				Long detailKey = Long.parseLong(detailId);
> 				
> 				for(AjaxFormLoopEntityHolder<ContactDetail> holder : details) {
> 					if(detailKey.equals(holder.getKey())) {
> 						ret = holder;
> 						break;
> 					}
> 				}
> 				
> 				return ret;
> 				
> 			}
> 		};
> 	}
> 
> On Tue, Apr 28, 2009 at 6:45 PM, Joost Schouten (mailing lists)
> <jo...@jsportal.com> wrote:
>> 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">
>>                                                        
>> ${message:components.entities.EntitiesContactDetails.addNewContactInfo} 
>>                                                </div>
>>                                        </div>
>>                                </t:block>
>>
>> I hope this is of use to you.
>>
>> Cheers,
>> Joost
>>
>> On Tue, Apr 28, 2009 at 6:15 PM, zack1403 <za...@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 <za...@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-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23271251.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by "Joost Schouten (mailing lists)" <jo...@jsportal.com>.
sorry, I forgot the encoder for the AjaxFormLoop:

public ValueEncoder<AjaxFormLoopEntityHolder<ContactDetail>>
getContactDetailEncoder() {
		
		final LegalEntityService service =
serviceProvider.getService(LegalEntityService.class);
		
		return new ValueEncoder<AjaxFormLoopEntityHolder<ContactDetail>>() {

			public String toClient(AjaxFormLoopEntityHolder<ContactDetail> detail) {
				return detail.getKey().toString();
			}

			public AjaxFormLoopEntityHolder<ContactDetail> toValue(String detailId) {
				
				AjaxFormLoopEntityHolder<ContactDetail> ret = null;
				
				Long detailKey = Long.parseLong(detailId);
				
				for(AjaxFormLoopEntityHolder<ContactDetail> holder : details) {
					if(detailKey.equals(holder.getKey())) {
						ret = holder;
						break;
					}
				}
				
				return ret;
				
			}
		};
	}

On Tue, Apr 28, 2009 at 6:45 PM, Joost Schouten (mailing lists)
<jo...@jsportal.com> wrote:
> 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 <za...@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 <za...@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-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by "Joost Schouten (mailing lists)" <jo...@jsportal.com>.
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 <za...@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 <za...@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-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
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 <za...@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by "Joost Schouten (mailing lists)" <jo...@jsportal.com>.
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 <za...@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
I just cant believe no one else is getting this with 5.1.0.2.  Am I the only
one having this issue? BTW, its happening with my AjaxFormLoops application
wide so its not just limited to one instance.

Zack

-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23248767.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
A single text field still triggers the exception.


Thiago H. de Paula Figueiredo wrote:
> 
> On Fri, Apr 24, 2009 at 1:34 AM, zack1403 <za...@gmail.com> wrote:
> 
>> Is there something with the setup that I am doing wrong?
> 
> Try using a TextField directly, without using BeanEditor and tell us
> what happens.
> 
> -- 
> Thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23222870.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, Apr 24, 2009 at 1:34 AM, zack1403 <za...@gmail.com> wrote:

> Is there something with the setup that I am doing wrong?

Try using a TextField directly, without using BeanEditor and tell us
what happens.

-- 
Thiago

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


Re: AjaxFormLoop Exception on 5.1.0.2 upgrade

Posted by zack1403 <za...@gmail.com>.
Seems like this would be a pretty common exception since the most basic form
of the component does not work. I mean this is way more basic than even the
tutorial.  

Is there something with the setup that I am doing wrong?

Zack
-- 
View this message in context: http://www.nabble.com/AjaxFormLoop-Exception-on-5.1.0.2-upgrade-tp23175801p23209682.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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