aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/scripts/formfiller.sh
diff options
context:
space:
mode:
authorGravatar Pawel Tomak <satherot@gmail.com>2010-03-28 18:26:48 +0200
committerGravatar Pawel Tomak <satherot@gmail.com>2010-03-28 18:26:48 +0200
commitd65308d54619c41f7c72266a549ccd42ce826f11 (patch)
tree26ddf7096ae30db20ea08678f05d3c3d67b8c147 /examples/data/scripts/formfiller.sh
parent4792e67bd0fb1fbdb224d617184f1d54eddaecd5 (diff)
checkbox (un)check fixups. Added comments about checkboxes/radiobuttons
Diffstat (limited to 'examples/data/scripts/formfiller.sh')
-rwxr-xr-xexamples/data/scripts/formfiller.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh
index 5eab784..b977235 100755
--- a/examples/data/scripts/formfiller.sh
+++ b/examples/data/scripts/formfiller.sh
@@ -17,6 +17,16 @@
# Keep in mind, that if you make more than one line for fileds like input
# text fields, then all lines will be inserted into as one line
#
+# Checkboxes/radio-buttons: to uncheck it type on of the following after the
+# colon:
+# no
+# off
+# 0
+# unchecked
+# false
+# or leave it blank, even without spaces
+# otherwise it will be considered as checked
+#
# user arg 1:
# edit: force editing the file (falls back to new if not found)
# new: start with a new file.
@@ -151,7 +161,7 @@ then
option=`echo -e -n "$menu"| dmenu ${LINES} -nb "${NB}" -nf "${NF}" -sb "${SB}" -sf "${SF}" -p "${PROMPT}"`
fi
- sed 's/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):.\+$/\1{\2}(\3):1/I;s/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):$/\1{\2}(\3):0/I' -i $keydir/$domain
+ sed 's/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):\(off\|no\|false\|unchecked\|0\|$\)/\1{\2}(\3):0/I;s/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[^0]\+/\1{\2}(\3):1/I' -i $keydir/$domain
fields=`cat $keydir/$domain | \
sed -n "/^!profile=${option}/,/^!profile=/p" | \
sed '/^!profile=/d' | \
@@ -175,7 +185,7 @@ then
[ -e $tmpfile ] || exit 2
- sed 's/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):.\+$/\1{\2}(\3):1/I;s/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):$/\1{\2}(\3):0/I' -i $tmpfile
+ sed 's/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):\(off\|no\|false\|unchecked\|0\|$\)/\1{\2}(\3):0/I;s/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[^0]\+/\1{\2}(\3):1/I' -i $tmpfile
fields=`cat $tmpfile | \
sed 's/^\([^(]\+(\)\(radio\|checkbox\|text\|textarea\|password\)):/%{>\1\2):<}%/' | \
sed 's/^\(.\+\)$/<{br}>\1/' | \