Author: drobiazko
Date: Thu Nov 19 21:14:56 2009
New Revision: 882298
URL: http://svn.apache.org/viewvc?rev=882298&view=rev
Log:
TAP5-779: CLONE -Linksubmit doesn't work inside a form with Zone parameter set
Modified:
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/linksubmit.js
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java
Modified:
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/linksubmit.js
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/linksubmit.js?rev=882298&r1=882297&r2=882298&view=diff
==============================================================================
---
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/linksubmit.js
(original)
+++
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/linksubmit.js
Thu Nov 19 21:14:56 2009
@@ -25,10 +25,13 @@
createHidden : function()
{
var hidden = new Element("input", { "type":"hidden",
+ "id": this.element.id + ":hidden",
"name": this.element.id + ":hidden",
"value": this.element.id});
- this.element.insert({after:hidden});
+ if (this.form.select("input#" + this.element.id + ":hidden").length ==
0)
+ this.element.insert({after:hidden});
+
},
onClick : function(event)
@@ -38,10 +41,11 @@
Event.stop(event);
var onsubmit = this.form.onsubmit;
-
+
+ this.createHidden();
+
if (onsubmit == undefined || onsubmit.call(window.document, event))
- {
- this.createHidden();
+ {
this.form.submit();
}
Modified:
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml?rev=882298&r1=882297&r2=882298&view=diff
==============================================================================
---
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml
(original)
+++
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app1/LinkSubmitInZoneDemo.tml
Thu Nov 19 21:14:56 2009
@@ -13,6 +13,8 @@
<p>You entered
<span id="outputvalue">${value}</span>
</p>
+ <p>"selected" event was fired: <span
id="eventfired">${eventfired}</span>
+ </p>
</t:if>
</t:zone>
@@ -21,7 +23,7 @@
<t:errors/>
<t:textfield t:id="value"/>
<br/>
- <t:linksubmit>submit</t:linksubmit>
+ <t:linksubmit t:id="mySubmit">submit</t:linksubmit>
</t:form>
</t:border>
\ No newline at end of file
Modified:
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java?rev=882298&r1=882297&r2=882298&view=diff
==============================================================================
---
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
(original)
+++
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
Thu Nov 19 21:14:56 2009
@@ -2786,6 +2786,8 @@
waitForElementToAppear("outputvalue");
assertText("outputvalue", "robot chicken");
+
+ assertText("eventfired", "true");
// Make sure it was a partial update
assertText("now", now);
Modified:
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java?rev=882298&r1=882297&r2=882298&view=diff
==============================================================================
---
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java
(original)
+++
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitInZoneDemo.java
Thu Nov 19 21:14:56 2009
@@ -14,7 +14,9 @@
package org.apache.tapestry5.integration.app1.pages;
+import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.beaneditor.Validate;
import org.apache.tapestry5.corelib.components.Zone;
@@ -26,9 +28,18 @@
@Property
@Validate("required")
private String value;
+
+ @Property
+ @Persist(PersistenceConstants.FLASH)
+ private boolean eventfired;
@InjectComponent
private Zone output;
+
+ void onSelectedFromMySubmit()
+ {
+ eventfired = true;
+ }
Object onSuccess()
{