printf '<textarea class="item %s" name="%s">%s</textarea>' \
"$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)"
done
+ printf '[button type="submit" name="action" value="addfield %s" %s ]' "$item" "$(l10n edit_addfield)"
;;
TEL) printf '[h3 %s]' "$(l10n "$item")"
seq 1 $cnt |while read c; do
printf '[input .item .%s name="%s" value="%s" placeholder="%s"]' \
"$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)" "$(l10n "$item")"
done
+ printf '[button type="submit" name="action" value="addfield %s" %s ]' "$item" "$(l10n edit_addfield)"
;;
*)printf '[h3 %s]' "$(l10n "$item")"
seq 1 $cnt |while read c; do
printf '[input .item .%s name="%s" value="%s" placeholder="%s"]' \
"$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)" "$(l10n "$item")"
done
+ printf '[button type="submit" name="action" value="addfield %s" %s ]' "$item" "$(l10n edit_addfield)"
;;
esac
done
. "$_EXEC/pdiread.sh"
. "$_EXEC/session_lock.sh"
+unset filter order card action newfield
+unset cardfile attfile tempfile
+unset vcf field cnt delete_key
+
filter="$(REF f)"
order="$(REF o)"
attfile="$_DATA/mappings/attendance"
action="$(POST action)"
-newfield="$(POST newfield)"
+newfield="$(POST newfield |grep -m 1 -xE '[A-Z][A-Z0-9-]*')"
+
+if printf '%s\n' "$action" |grep -qxE 'addfield [A-Z][A-Z0-9]*'; then
+ newfield="${action##* }"
+ action=addfield
+fi
if ! tempfile=$(CHECK_SLOCK "$cardfile"); then
SET_COOKIE 0 message="NO VALID FILE LOCK"