Hi,
I attached the patch to this email (T53 only atm).
The patch contains a test case *and* I ran the whole test suite (*)
If you think the path is ok I would:
- open a new Jira issue with the correct bug desc and attach the patch to it
- port the patch to T54
I also think that somebody should close and link TAP5-311 and TAP5-983 to the
new issue once created.
Luca
(*) while implementing the new test case I found out that two tests in
org.apache.tapestry5.integration.app1.BeanEditorTests
are not run because they miss the @Test annotation.
Luca Menegus
D.B.M. S.r.l
Via Enrico Noe, 23 - 20133 Milano (MI) Italy.
Phone: +39 02 26600525
Mobile: +39 3346220663
----- Original Message -----
> From: "Luca Menegus" <[email protected]>
> To: "Tapestry users" <[email protected]>
> Sent: Friday, November 1, 2013 8:18:13 PM
> Subject: Re: [T53] [BUG] Beandisplay can't be used inside a form
>
> Thank you very much Thiago,
> working on it, ETA is Monday (setting up proper test env is not trivial)
>
> thanks,
> Luca
>
> ----- Original Message -----
> > From: "Thiago H de Paula Figueiredo" <[email protected]>
> > To: "Tapestry users" <[email protected]>
> > Sent: Friday, November 1, 2013 7:44:40 PM
> > Subject: Re: [T53] [BUG] Beandisplay can't be used inside a form
> >
> > On Fri, 01 Nov 2013 16:00:43 -0200, Luca Menegus <[email protected]> wrote:
> >
> > > Hi all,
> >
> > Hi!
> >
> > > in
> > > tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
> > > the loop component has the formState parameter set to "ITERATION" while
> > > (probably) should be set to "NONE".
> >
> > Good catch! Thanks!
> >
> > > PS: I would be *really* happy to contribute a patch and test case *if*
> > > any committer has interest in fixing this bug.
> >
> > Go ahead. :)
> >
> > > I would also be ready to check the behavior in T54 where the form
> > > submission logic has changed (from POST+GET to POST)
> >
> > Actually, this changed only when validation fails to avoid session usage.
> >
> > >
> > > [1] https://issues.apache.org/jira/browse/TAP5-311
> > > [2] https://issues.apache.org/jira/browse/TAP5-983
> > > [3] example code
> > > Example.tml:
> > > <t:form>
> > > <div t:id="testBeanDisplay" />
> > > <input t:type="submit"/>
> > > </t:form>
> > >
> > > Example.java:
> > > @Component(parameters = { "object=testbean" })
> > > private BeanDisplay testBeanDisplay;
> > > @Persist //No matter if persisted or not
> > > @Property
> > > private TestBean testbean;
> > > void onActivate() {
> > > if (testbean == null) {
> > > testbean = new TestBean();
> > > }
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> >
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
index 2e56cd4..28dcd59 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
@@ -1,7 +1,7 @@
<dl class="t-beandisplay" xml:space="default"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
- <t:loop t:source="model.propertyNames" formState="ITERATION" t:value="propertyName">
+ <t:loop t:source="model.propertyNames" formState="NONE" t:value="propertyName">
<dt class="${propertyClass}">${propertyModel.label}</dt>
diff --git a/tapestry-core/src/test/app1/BeanDisplayInFormDemo.tml b/tapestry-core/src/test/app1/BeanDisplayInFormDemo.tml
new file mode 100644
index 0000000..234f169
--- /dev/null
+++ b/tapestry-core/src/test/app1/BeanDisplayInFormDemo.tml
@@ -0,0 +1,13 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
+ <h1>BeanDisplay in Form demo</h1>
+ <t:form>
+ <t:beandisplay object="prop:item" />
+ <div class="t-beaneditor-row">
+ <t:label for="urgency"/>
+ <t:select t:id="urgency" value="prop:item.urgency"/>
+ </div>
+ <div class="t-beaneditor-row">
+ <input type="submit"/>
+ </div>
+ </t:form>
+</html>
\ No newline at end of file
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java
index 46d5c13..95a9d65 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java
@@ -206,6 +206,21 @@ public class BeanEditorTests extends TapestryCoreTestCase
assertText("//dd[2]", "Ultra Important");
}
+
+ @Test
+ public void bean_display_in_form()
+ {
+ openLinks("BeanDisplay In Form Demo");
+
+ assertText("//dd[2]", "Low");
+
+ type("urgency", "HIGH");
+
+ clickAndWait(SUBMIT);
+
+ assertText("//dd[2]", "High");
+
+ }
/** TAP5-1527 */
public void bean_editor_prepare_bubbling()
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanDisplayInFormDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanDisplayInFormDemo.java
new file mode 100644
index 0000000..9e50973
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanDisplayInFormDemo.java
@@ -0,0 +1,30 @@
+package org.apache.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.integration.app1.data.ToDoItem;
+import org.apache.tapestry5.integration.app1.data.Urgency;
+
+/**
+ * Used to demonstrate BeanDisplay can be used inside a Form.
+ */
+public class BeanDisplayInFormDemo {
+
+ @Persist
+ @Property
+ private ToDoItem item;
+
+ void onActivate()
+ {
+ if (item == null)
+ {
+ item = new ToDoItem();
+ item.setId(1);
+ item.setOrder(1);
+ item.setTitle("Develop Faster-Than-Light Travel");
+ item.setUrgency(Urgency.LOW);
+ }
+ }
+
+}
+
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index b9c336b..3df2976 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -475,6 +475,9 @@ public class Index
new Item("BeanDisplayEnumDemo", "BeanDisplay Enum Demo",
"User represenation of enum values is correctly read from messages"),
+ new Item("BeanDisplayInFormDemo", "BeanDisplay In Form Demo",
+ "Use of BeanDisplay in Form"),
+
new Item("unavailablecomponentdemo", "Report Location of Unavailable Component",
"Report Location of Unavailable Component"),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]