Module: check_mk
Branch: master
Commit: 118f15eabd93792e033a2e2fef30aff0b8d77d04
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=118f15eabd9379…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 20 10:04:49 2012 +0100
Checkboxes visualize user input errors now
---
web/htdocs/htmllib.py | 4 ++--
web/htdocs/pages.css | 13 ++++++++++++-
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index d6b78d5..58399cd 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -517,7 +517,7 @@ class html:
add_attr = [] # do not use [] as default element, it will be a global
variable!
error = self.user_errors.get(varname)
if error:
- html = "<x class=inputerror>"
+ self.write("<x class=inputerror><span
class=checkbox>")
# Problem with checkboxes: The browser will add the variable
# only to the URL if the box is checked. So in order to detect
# wether we should add the default value, we need to detect
@@ -541,7 +541,7 @@ class html:
if label:
self.write('<label for="%s">%s</label>\n' %
(id, label))
if error:
- html += "</x>"
+ self.write("</span></x>")
# Get value of checkbox. Return True, False or None. None means
# that no form has been submitted. The problem here is the distintion
diff --git a/web/htdocs/pages.css b/web/htdocs/pages.css
index 81dc880..cec1284 100644
--- a/web/htdocs/pages.css
+++ b/web/htdocs/pages.css
@@ -475,10 +475,21 @@ input.date, input.time {
font-family: monospace;
}
-.inputerror input, .inputerror textarea {
+.inputerror input, .inputerror textarea, span.checkbox {
background-color: #f84;
}
+.inputerror span.checkbox {
+ display: block;
+ float: left;
+ height: 17px;
+ margin-right: 2px;
+}
+
+.inputerror span.checkbox input {
+ margin: 1px;
+}
+
/*-------------------------------------------------------------------------.
| _ _ _ |
| / \ ___| |_(_) ___ _ __ ___ |