Index: trunk/lib/Text/FormBuilder.pm
===================================================================
--- trunk/lib/Text/FormBuilder.pm	(revision 24)
+++ trunk/lib/Text/FormBuilder.pm	(revision 25)
@@ -77,5 +77,5 @@
     
     # substitute in custom pattern definitions for field validation
-    if (my %patterns = %{ $self->{form_spec}{patterns} || {} }) {
+    if (my %patterns = %{ $self->{form_spec}{patterns} }) {
         foreach (@{ $self->{form_spec}{fields} }) {
             if ($$_{validate} and exists $patterns{$$_{validate}}) {
@@ -85,8 +85,8 @@
     }
     
-    # so we don't get all fields required
-    foreach (@{ $self->{form_spec}{fields} }) {
-        delete $$_{validate} unless $$_{validate};
-    }
+##     # so we don't get all fields required
+##     foreach (@{ $self->{form_spec}{fields} }) {
+##         delete $$_{validate} unless $$_{validate};
+##     }
 
     # expand groups
@@ -117,21 +117,25 @@
     
     # substitute in list names
-    if (my %lists = %{ $self->{form_spec}{lists} || {} }) {
-        foreach (@{ $self->{form_spec}{fields} }) {
-            next unless $$_{list};
-            
-            $$_{list} =~ s/^\@//;   # strip leading @ from list var name
-            
-            # a hack so we don't get screwy reference errors
-            if (exists $lists{$$_{list}}) {
-                my @list;
-                push @list, { %$_ } foreach @{ $lists{$$_{list}} };
-                $$_{options} = \@list;
-            }
-        } continue {
-            delete $$_{list};
+    my %lists = %{ $self->{form_spec}{lists} };
+    foreach (@{ $self->{form_spec}{fields} }) {
+        next unless $$_{list};
+        
+        $$_{list} =~ s/^\@//;   # strip leading @ from list var name
+        
+        # a hack so we don't get screwy reference errors
+        if (exists $lists{$$_{list}}) {
+            my @list;
+            push @list, { %$_ } foreach @{ $lists{$$_{list}} };
+            $$_{options} = \@list;
+        } else {
+##             #TODO: this is not working in CGI::FormBuilder
+##             # assume that the list name is a builtin 
+##             # and let it fall through to CGI::FormBuilder
+##             $$_{options} = $$_{list};
+##             warn "falling through to builtin $$_{options}";
         }
-    }
-    
+    } continue {
+        delete $$_{list};
+    }    
     
     # TODO: configurable threshold for this
@@ -155,4 +159,5 @@
         required => [ map { $$_{name} } grep { $$_{required} } @{ $self->{form_spec}{fields} } ],
         title => $self->{form_spec}{title},
+        text  => $self->{form_spec}{description},
         template => {
             type => 'Text',
@@ -222,4 +227,5 @@
         %DEFAULT_OPTIONS,
         title => $self->{form_spec}{title},
+        text  => $self->{form_spec}{description},
         required => [ map { $$_{name} } grep { $$_{required} } @{ $self->{form_spec}{fields} } ],
         template => {
Index: trunk/lib/Text/FormBuilder/grammar
===================================================================
--- trunk/lib/Text/FormBuilder/grammar	(revision 24)
+++ trunk/lib/Text/FormBuilder/grammar	(revision 25)
@@ -29,10 +29,10 @@
 	    author   => $author,
 	    description => $description,
-	    lists    => \%lists, 
-	    patterns => \%patterns, 
-	    headings => \@headings,
-	    fields   => \@fields,
-	    lines    => \@lines,
-	    groups   => \%groups,
+	    lists    => \%lists    || {}, 
+	    patterns => \%patterns || {}, 
+	    headings => \@headings || [],
+	    fields   => \@fields   || [],
+	    lines    => \@lines    || [],
+	    groups   => \%groups   || {},
 	}
     }
@@ -169,5 +169,5 @@
 list_var: /@[A-Z_]+/ { $list_var = $item[1] }
 
-option: (value | simple_multiword | quoted_string) display_text(?)
+option: (simple_multiword | value | quoted_string) display_text(?)
     { push @options, { $item[1] => $item{'display_text(?)'}[0] } }
 
