diff --git a/library/server/wsf_html/webcontrol/validators/wsf_phone_number_validator.e b/library/server/wsf_html/webcontrol/validators/wsf_phone_number_validator.e index 5b7374e8..d9020b00 100644 --- a/library/server/wsf_html/webcontrol/validators/wsf_phone_number_validator.e +++ b/library/server/wsf_html/webcontrol/validators/wsf_phone_number_validator.e @@ -6,16 +6,19 @@ note class WSF_PHONE_NUMBER_VALIDATOR + inherit - WSF_VALIDATOR[STRING] + + WSF_REGEXP_VALIDATOR + create - make + make_with_message -feature -- Implementation +feature {NONE} - validate(input:STRING):BOOLEAN - do - - end + make_with_message (e: STRING) + do + make_regexp_validator ("", e) + end end diff --git a/library/server/wsf_html/webcontrol/validators/wsf_regexp_validator.e b/library/server/wsf_html/webcontrol/validators/wsf_regexp_validator.e new file mode 100644 index 00000000..8e20b710 --- /dev/null +++ b/library/server/wsf_html/webcontrol/validators/wsf_regexp_validator.e @@ -0,0 +1,40 @@ +note + description: "Summary description for {WSF_REGEXP_VALIDATOR}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + WSF_REGEXP_VALIDATOR + +inherit + + WSF_VALIDATOR [STRING] + +create + make_regexp_validator + +feature {NONE} + + make_regexp_validator (r, e: STRING) + do + make(e) + regexp_string := r + create regexp + regexp.compile (r) + end + +feature -- Implementation + + validate (input: STRING): BOOLEAN + do + Result := regexp.matches (input) + end + +feature + + regexp_string: STRING + + regexp: REGULAR_EXPRESSION + +end diff --git a/library/server/wsf_html/webcontrol/wsf_validator.e b/library/server/wsf_html/webcontrol/validators/wsf_validator.e similarity index 100% rename from library/server/wsf_html/webcontrol/wsf_validator.e rename to library/server/wsf_html/webcontrol/validators/wsf_validator.e diff --git a/library/server/wsf_html/wsf_html-safe.ecf b/library/server/wsf_html/wsf_html-safe.ecf index bb8c3577..f3ae7f4e 100644 --- a/library/server/wsf_html/wsf_html-safe.ecf +++ b/library/server/wsf_html/wsf_html-safe.ecf @@ -11,11 +11,9 @@ - - - +