From 5dc95b27cbb0d2f96f8545bc1ae1bb80c1df9fb2 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Mon, 8 Dec 2014 22:15:32 +0000 Subject: [PATCH] Fixes #33 --- forms.tmpl | 2 +- forum.nim | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/forms.tmpl b/forms.tmpl index e21b439..e215afd 100644 --- a/forms.tmpl +++ b/forms.tmpl @@ -181,7 +181,7 @@
#if action == "doreply": - + ${HiddenField(c, "subject", title)} #else: ${FieldValid(c, "subject", "Subject:")} ${TextWidget(c, "subject", title, maxlength=100)} diff --git a/forum.nim b/forum.nim index 5ac4ad6..d330dbe 100644 --- a/forum.nim +++ b/forum.nim @@ -103,6 +103,11 @@ proc TextWidget(c: TForumData, name, defaultText: string, return """""" % [ name, $maxlength, x, if size != -1: "size=\"" & $size & "\"" else: ""] +proc HiddenField(c: TForumData, name, defaultText: string): string = + let x = if defaultText != reuseText: defaultText + else: xmlEncode(c.req.params[name]) + return """""" % [name, x] + proc TextAreaWidget(c: TForumData, name, defaultText: string): string = let x = if defaultText != reuseText: defaultText else: xmlEncode(c.req.params[name])