From f52f6512a0f871c363306d09efbf29ea5b647d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Severin=20M=C3=BCnger?= Date: Thu, 5 Sep 2013 16:51:51 +0200 Subject: [PATCH] Restructured validators, fixed form element rendering --- .../validators/wsf_phone_number_validator.e | 21 +++++++++++++++++++ .../webcontrol/wsf_form_element_control.e | 5 +++-- .../wsf_html/webcontrol/wsf_validator.e | 7 +++++++ library/server/wsf_html/wsf_html-safe.ecf | 7 ++++++- 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 library/server/wsf_html/webcontrol/validators/wsf_phone_number_validator.e 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 new file mode 100644 index 00000000..5b7374e8 --- /dev/null +++ b/library/server/wsf_html/webcontrol/validators/wsf_phone_number_validator.e @@ -0,0 +1,21 @@ +note + description: "Summary description for {WSF_PHONE_NUMBER_VALIDATOR}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + WSF_PHONE_NUMBER_VALIDATOR +inherit + WSF_VALIDATOR[STRING] +create + make + +feature -- Implementation + + validate(input:STRING):BOOLEAN + do + + end + +end diff --git a/library/server/wsf_html/webcontrol/wsf_form_element_control.e b/library/server/wsf_html/webcontrol/wsf_form_element_control.e index 7f0d376a..593a735a 100644 --- a/library/server/wsf_html/webcontrol/wsf_form_element_control.e +++ b/library/server/wsf_html/webcontrol/wsf_form_element_control.e @@ -20,6 +20,7 @@ feature {NONE} do make (n, "div") add_class ("form-group") + c.add_class ("form-control") value_control := c validators := v label := "" @@ -56,11 +57,11 @@ feature --Implementation render: STRING local - body:STRING + body: STRING do body := "" if not label.is_empty then - body := "" + body := "" end body := body + "
" body := body + value_control.render diff --git a/library/server/wsf_html/webcontrol/wsf_validator.e b/library/server/wsf_html/webcontrol/wsf_validator.e index dd29be01..58415781 100644 --- a/library/server/wsf_html/webcontrol/wsf_validator.e +++ b/library/server/wsf_html/webcontrol/wsf_validator.e @@ -7,6 +7,13 @@ note deferred class WSF_VALIDATOR [G] +feature {NONE} + + make (e: STRING) + do + error := e + end + feature validate (input: G): BOOLEAN diff --git a/library/server/wsf_html/wsf_html-safe.ecf b/library/server/wsf_html/wsf_html-safe.ecf index e5aaeeb4..bb8c3577 100644 --- a/library/server/wsf_html/wsf_html-safe.ecf +++ b/library/server/wsf_html/wsf_html-safe.ecf @@ -11,6 +11,9 @@ + + + @@ -18,7 +21,9 @@ - + + +