Hi,
Sometimes I want to have a RegExp filter for a textfield, not for
individual characters.
I'm aware of the filter property in AbstractField, and so I made a new
one called bigFilter
I prepared a patch and here's a small testcase http://pastie.org/1345097
In the textfield you can only enter between 1 and 5 characters.
notice that you need to apply the patch, recompile playground and try
it within your local playground for it to work.
let me know what you think, thanks
Index: ../../framework/source/class/qx/ui/form/AbstractField.js
===================================================================
--- ../../framework/source/class/qx/ui/form/AbstractField.js (revision 23089)
+++ ../../framework/source/class/qx/ui/form/AbstractField.js (working copy)
@@ -194,7 +194,18 @@
check : "RegExp",
nullable : true,
init : null
+ },
+
+ bigFilter:
+ {
+ check : "RegExp",
+ nullable : true,
+ init : null
}
+
+
+
+
},
@@ -457,6 +468,28 @@
this.__nullValue = false;
// check for the filter
+
+ if (this.getBigFilter() != null) {
+
+ console.log("checking big filter");
+ var filteredValue = "";
+
+ filteredValue =
+ value.match(this.getBigFilter())
+ ? value
+ : this.__oldInputValue || "";
+
+ console.log("value="+value+" , filteredValue="+filteredValue + " match=" + value.match(this.getBigFilter()));
+
+ if (filteredValue != value)
+ {
+ fireEvents = false;
+ value = filteredValue;
+ this.getContentElement().setValue(value);
+ }
+ };
+
+
if (this.getFilter() != null)
{
var filteredValue = "";
@@ -842,4 +875,4 @@
qx.locale.Manager.getInstance().removeListener("changeLocale", this._onChangeLocale, this);
}
}
-});
\ No newline at end of file
+});
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel