1.1 --- a/MoinForms.py Sat Dec 01 20:38:35 2012 +0100
1.2 +++ b/MoinForms.py Sat Dec 01 23:26:28 2012 +0100
1.3 @@ -45,7 +45,7 @@
1.4 ))
1.5
1.6 output = getFormOutput(text, fields)
1.7 - write(formatText(output, request, fmt))
1.8 + write(formatText(output, request, fmt, inhibit_p=False))
1.9
1.10 write(fmt.rawHTML('</form>'))
1.11
2.1 --- a/macros/FormField.py Sat Dec 01 20:38:35 2012 +0100
2.2 +++ b/macros/FormField.py Sat Dec 01 23:26:28 2012 +0100
2.3 @@ -123,6 +123,7 @@
2.4 # Obtain any request parameters corresponding to the field.
2.5
2.6 form = get_form(request)
2.7 + values = form.get(ref, [])
2.8 value = form.get(ref, [""])[0]
2.9
2.10 # Render the field.
2.11 @@ -154,12 +155,17 @@
2.12 if not sourcedict:
2.13 return showError(_("WikiDict %s cannot be loaded for %s.") % (sourcedict, name), request)
2.14
2.15 + size = field_args.get("size", [None])[0]
2.16 + size = size and int(size) or size
2.17 +
2.18 output = []
2.19 - output.append(fmt.rawHTML('<select name="%s">' % escattr(ref)))
2.20 + output.append(fmt.rawHTML('<select name="%s" %s>' % (escattr(ref), size != 1 and "multiple" or "")))
2.21
2.22 for option, label in sourcedict.items():
2.23 + is_selected = size == 1 and option == value or size != 1 and option in values
2.24 +
2.25 output.append(fmt.rawHTML('<option value="%s" %s>%s</option>' % (
2.26 - escattr(option), value == option and "selected" or "", escape(label))
2.27 + escattr(option), is_selected and "selected" or "", escape(label))
2.28 ))
2.29
2.30 output.append(fmt.rawHTML('</select>'))