helper functions for checking item selections
authorPaul Hänsch <paul@plutz.net>
Sun, 8 Dec 2019 22:14:24 +0000 (23:14 +0100)
committerPaul Hänsch <paul@plutz.net>
Sun, 8 Dec 2019 22:14:24 +0000 (23:14 +0100)
index.cgi

index 43abf5d..093a5c4 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -18,6 +18,9 @@ ACTION="$(GET a)"
 message="$(COOKIE message)"
 [ "$message" ] && SET_COOKIE 0 message=''
 
 message="$(COOKIE message)"
 [ "$message" ] && SET_COOKIE 0 message=''
 
+checked(){  [ "$1" = "$2" ] || [ "$1" -eq "$2" ] && printf 'checked="checked"' 2>/dev/null; }
+selected(){ [ "$1" = "$2" ] || [ "$1" -eq "$2" ] && printf 'selected="selected"' 2>/dev/null; }
+
 yield_page() {
   local class="$1" style="$2"
   printf 'Content-Type: text/html; charset=utf-8\r\n\r\n'
 yield_page() {
   local class="$1" style="$2"
   printf 'Content-Type: text/html; charset=utf-8\r\n\r\n'