You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by th...@apache.org on 2014/12/07 03:29:01 UTC
[03/45] tapestry-5 git commit: TAP5-2362: Client-side regular
expression field validation should ensure that the entire value matches the
pattern
TAP5-2362: Client-side regular expression field validation should ensure that the entire value matches the pattern
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/57a8d25d
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/57a8d25d
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/57a8d25d
Branch: refs/heads/beanmodel-split
Commit: 57a8d25ddff8fe5edf102f5bf4e7fe324c409611
Parents: 1f09cb6
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Oct 21 16:57:48 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Oct 21 16:57:48 2014 -0700
----------------------------------------------------------------------
.../coffeescript/META-INF/modules/t5/core/validation.coffee | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/57a8d25d/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/validation.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/validation.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/validation.coffee
index 9a22686..5cda63c 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/validation.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/validation.coffee
@@ -1,5 +1,3 @@
-# Copyright 2012 The Apache Software Foundation
-#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -143,7 +141,11 @@ define ["underscore", "./dom", "./events", "./utils", "./messages", "./fields"],
re = new RegExp(@attr "data-validate-regexp")
@meta REGEXP_META, re
- unless re.test memo.translated
+ groups = memo.translated.match re
+
+ # Unlike Java, there isn't an easy way to match the entire string. This
+ # gets the job done.
+ if (groups is null) or (groups[0] isnt memo.translated)
memo.error = (@attr "data-regexp-message") or "INVALID"
return false