You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2007/05/17 05:40:11 UTC
svn commit: r538799 - in /tapestry/tapestry4/trunk/tapestry-framework/src:
java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java
test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java
Author: jkuhnert
Date: Wed May 16 20:40:10 2007
New Revision: 538799
URL: http://svn.apache.org/viewvc?view=rev&rev=538799
Log:
@EventListener(validateForm = true/false) was only being applied to client side validation. Appropriately made calls to IValidationDelegate.clearErrors() when validation is disabled.
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java?view=diff&rev=538799&r1=538798&r2=538799
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java Wed May 16 20:40:10 2007
@@ -109,8 +109,16 @@
if (!listeners[e].getComponentId().endsWith(strippedId))
continue;
-
- // handle disabling focus
+
+ // clear validation errors but not input if async validation is
+ // disabled
+
+ if (!listeners[e].isValidateForm()) {
+
+ form.getDelegate().clearErrors();
+ }
+
+ // handle disabling focus
if (!disableFocus && !listeners[e].shouldFocusForm())
disableFocus = true;
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java?view=diff&rev=538799&r1=538798&r2=538799
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java Wed May 16 20:40:10 2007
@@ -22,6 +22,7 @@
import org.apache.tapestry.listener.ListenerMap;
import org.apache.tapestry.spec.ComponentSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
+import org.apache.tapestry.valid.IValidationDelegate;
import static org.easymock.EasyMock.*;
import org.testng.annotations.Test;
@@ -195,7 +196,7 @@
checkOrder(form, false);
FormSupport formSupport = newMock(FormSupport.class);
IComponentSpecification spec = new ComponentSpecification();
-
+ IValidationDelegate delegate = newMock(IValidationDelegate.class);
ListenerInvoker listenerInvoker = newMock(ListenerInvoker.class);
ListenerMap listenerMap = newMock(ListenerMap.class);
IActionListener listener = newMock(IActionListener.class);
@@ -223,6 +224,11 @@
expect(page.getComponents()).andReturn(comps);
expect(form.getSpecification()).andReturn(spec);
+ expect(form.getDelegate()).andReturn(delegate).anyTimes();
+
+ delegate.clearErrors();
+ expectLastCall().anyTimes();
+
expect(form.getListeners()).andReturn(listenerMap);
expect(listenerMap.getListener("fooListener")).andReturn(listener);
@@ -245,6 +251,7 @@
checkOrder(form, false);
FormSupport formSupport = newMock(FormSupport.class);
IComponentSpecification spec = new ComponentSpecification();
+ IValidationDelegate delegate = newMock(IValidationDelegate.class);
ListenerInvoker listenerInvoker = newMock(ListenerInvoker.class);
ListenerMap listenerMap = newMock(ListenerMap.class);
@@ -273,6 +280,11 @@
expect(page.getComponents()).andReturn(comps);
expect(form.getSpecification()).andReturn(spec);
+ expect(form.getDelegate()).andReturn(delegate).anyTimes();
+
+ delegate.clearErrors();
+ expectLastCall().anyTimes();
+
expect(form.getListeners()).andReturn(listenerMap);
expect(listenerMap.getListener("fooListener")).andReturn(listener);