Browse Source

add placeholder Filters.filterDlgCheckRegExp

Andrew Dolgov 1 year ago
parent
commit
86a014f23b
2 changed files with 9 additions and 1 deletions
  1. 2 1
      classes/pref/filters.php
  2. 7 0
      js/CommonFilters.js

+ 2 - 1
classes/pref/filters.php

@@ -976,7 +976,8 @@ class Pref_Filters extends Handler_Protected {
 		print "<section>";
 
 		print "<input dojoType=\"dijit.form.ValidationTextBox\"
-			 required=\"true\" id=\"filterDlg_regExp\"
+			 required=\"true\" id=\"filterDlg_regExp\" 
+			 onchange='Filters.filterDlgCheckRegExp(this)'
 			 style=\"font-size : 16px; width : 20em;\"
 			 name=\"reg_exp\" value=\"$reg_exp\"/>";
 

+ 7 - 0
js/CommonFilters.js

@@ -2,6 +2,13 @@
 /* global __, ngettext */
 define(["dojo/_base/declare"], function (declare) {
 	Filters = {
+		filterDlgCheckRegExp: function(sender) {
+			try {
+				new RegExp("/" + sender.value + "/");
+			} catch (e) {
+				console.error(e);
+			}
+		},
 		filterDlgCheckAction: function(sender) {
 			const action = sender.value;