diff options
| author | estadtherr <estadtherr@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2006-09-14 03:49:28 +0000 |
|---|---|---|
| committer | estadtherr <estadtherr@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2006-09-14 03:49:28 +0000 |
| commit | a4332663cfcdb53b352c8646f78855ae3436cfec (patch) | |
| tree | ceaf2d8afbf791e9d007cfe7a676fc1e0790b7a6 /roundcubemail/program/js/tiny_mce/utils/validate.js | |
| parent | 8b3252550799d1b69ba8ff0c0fb3f916608c2e1d (diff) | |
Initial TinyMCE editor support (still need to work on spellcheck and skins)
git-svn-id: https://svn.roundcube.net/trunk@344 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/js/tiny_mce/utils/validate.js')
| -rw-r--r-- | roundcubemail/program/js/tiny_mce/utils/validate.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/roundcubemail/program/js/tiny_mce/utils/validate.js b/roundcubemail/program/js/tiny_mce/utils/validate.js new file mode 100644 index 000000000..747b62bb6 --- /dev/null +++ b/roundcubemail/program/js/tiny_mce/utils/validate.js @@ -0,0 +1,50 @@ +/**
+ * $RCSfile: validate.js,v $
+ * $Revision: 1.3 $
+ * $Date: 2006/02/06 20:11:09 $
+ *
+ * Various form validation methods.
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+function testRegExp(form_name, element_name, re) {
+ return new RegExp(re).test(document.forms[form_name].elements[element_name].value);
+}
+
+function validateString(form_name, element_name) {
+ return (document.forms[form_name].elements[element_name].value.length > 0);
+}
+
+function validateSelection(form_name, element_name) {
+ return (document.forms[form_name].elements[element_name].selectedIndex > 0);
+}
+
+function validateCheckBox(form_name, element_name) {
+ return document.forms[form_name].elements[element_name].checked;
+}
+
+function validateCleanString(form_name, element_name) {
+ return testRegExp(form_name, element_name, '^[A-Za-z0-9_]+$');
+}
+
+function validateEmail(form_name, element_name) {
+ return testRegExp(form_name, element_name, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
+}
+
+function validateAbsUrl(form_name, element_name) {
+ return testRegExp(form_name, element_name, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+$');
+}
+
+function validateNumber(form_name, element_name, allow_blank) {
+ return (!allow_blank && value == '') ? false : testRegExp(form_name, element_name, '^-?[0-9]*\\.?[0-9]*$');
+}
+
+function validateSize(form_name, element_name,) {
+ return testRegExp(form_name, element_name, '^[0-9]+(px|%)?$');
+}
+
+function validateID(form_name, element_name,) {
+ return testRegExp(form_name, element_name, '^[A-Za-z_]([A-Za-z0-9_])*$');
+}
|
