You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/04/01 03:37:59 UTC
svn commit: r643237 -
/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js
Author: hlship
Date: Mon Mar 31 18:37:51 2008
New Revision: 643237
URL: http://svn.apache.org/viewvc?rev=643237&view=rev
Log:
TAPESTRY-2319: Add support for client-side form-level validation
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js?rev=643237&r1=643236&r2=643237&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js Mon Mar 31 18:37:51 2008
@@ -84,16 +84,25 @@
});
},
+ getFormEventManager : function(form)
+ {
+ form = $(form);
+
+ var manager = form.eventManager;
+
+ if (manager == undefined)
+ manager = new Tapestry.FormEventManager(form);
+
+ return manager;
+ },
+
registerValidation : function(clientValidations)
{
$H(clientValidations).each(function(pair)
{
var field = $(pair.key);
- var form = $(field.form);
-
- if (! form.eventManager)
- form.eventManager = new Tapestry.FormEventManager(form);
+ Tapestry.getFormEventManager(field.form);
var specs = pair.value;
@@ -682,15 +691,6 @@
if (this.field.disabled) return;
if (! this.field.isDeepVisible()) return;
-
- // Clear out old decorations. It's easier to remove the decorations
- // and then re-add them if the field is in error than it is to
- // toggle them on or off at the end.
-
- event.field.removeClassName("t-error");
-
- if (this.label)
- this.label.removeClassName("t-error");
var value = $F(event.field);
var isBlank = (value == '');