1.1 --- a/MoinForms.py Mon Dec 03 01:08:19 2012 +0100
1.2 +++ b/MoinForms.py Mon Dec 03 01:15:19 2012 +0100
1.3 @@ -102,7 +102,7 @@
1.4
1.5 # Test for obligatory values.
1.6
1.7 - if not value:
1.8 + if not value or not value[0]:
1.9 if field_args.get("required"):
1.10 errors.append(_("This field must be filled out."))
1.11 else:
1.12 @@ -294,6 +294,10 @@
1.13
1.14 elif format == "form":
1.15 section_name = attributes.get("section")
1.16 + message_name = attributes.get("message")
1.17 +
1.18 + # Sections are groups of fields in their own namespace.
1.19 +
1.20 if section_name and section.has_key(section_name):
1.21
1.22 # Iterate over the section contents ignoring the given indexes.
1.23 @@ -306,6 +310,12 @@
1.24 output.append(getFormOutput(body, element,
1.25 path and ("%s/%s" % (path, element_ref)) or element_ref))
1.26
1.27 + # Message regions are conditional on a particular field and
1.28 + # reference the current namespace.
1.29 +
1.30 + elif message_name and section.has_key(message_name):
1.31 + output.append(getFormOutput(body, section, path))
1.32 +
1.33 # Inspect and include other regions.
1.34
1.35 else: