Changeset 80 in text-formbuilder for trunk/lib/Text
- Timestamp:
- 04/12/05 11:23:36 (20 years ago)
- Location:
- trunk/lib/Text
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder.pm
r77 r80 7 7 use vars qw($VERSION @EXPORT); 8 8 9 $VERSION = '0.1 0';9 $VERSION = '0.11_01'; 10 10 @EXPORT = qw(create_form); 11 11 … … 296 296 title => $self->{form_spec}{title}, 297 297 text => $self->{form_spec}{description}, 298 submit => $self->{form_spec}{submit}, 298 299 template => { 299 300 type => 'Text', … … 963 964 ... 964 965 } 966 967 !submit button label, button label 2, ... 965 968 966 969 =head2 Directives … … 1013 1016 A text note that can be inserted as a row in the form. This is useful for 1014 1017 special instructions at specific points in a long form. 1018 1019 =item C<!submit> 1020 1021 A list of one or more submit button labels in a comma-separated list. Each label 1022 is a L<string|/Strings>. Multiple instances of this directive may be used; later 1023 lists are simply appended to the earlier lists. All the submit buttons are 1024 rendered together at the bottom of the form. See L<CGI::FormBuilder> for an 1025 explanation of how the multiple submit buttons work together in a form. 1015 1026 1016 1027 =back … … 1099 1110 person*:text 1100 1111 1112 To set a limit to the maximum number of inputs a field can grow to, add 1113 a number after the C<*>: 1114 1115 # allow up to 5 musicians 1116 musician*5:text 1117 1101 1118 To create a C<radio> or C<select> field that includes an "other" option, 1102 1119 append the string C<+other> to the field type: … … 1223 1240 =head2 Language/Parser 1224 1241 1242 Debug flag (that sets/unsets C<$::RD_TRACE> in the parser) 1243 1225 1244 Make sure that multiple runs of the parser don't share data. 1226 1245 1227 Allow renaming of the submit button; allow renaming and inclusion of a 1228 reset button 1246 Allow renaming and inclusion of a reset button 1247 1248 Warn/suggest using the C<!submit> directive if some uses C<foo:submit>? 1229 1249 1230 1250 Set FB constructor options directly in the formspec (via a C<!fb> or similar … … 1245 1265 option to C<< FB->new >>; will require FB 3.02 to run. 1246 1266 1247 Better integration with L<CGI::FormBuilder>'s templating system 1267 Better integration with L<CGI::FormBuilder>'s templating system; rely on the 1268 FB messages instead of trying to make our own. 1248 1269 1249 1270 Allow for custom wrappers around the C<form_template> -
trunk/lib/Text/FormBuilder/grammar
r77 r80 24 24 $rows, 25 25 $cols, 26 @submit, 26 27 ); 27 28 my $context = 'line'; # start in line context by default … … 38 39 %formspec = (); # clear the old formspec data 39 40 } 40 (list_def | description_def | group_def | note | line)(s)41 (list_def | description_def | group_def | note | unknown_block_directive | line)(s) 41 42 { 42 43 # grab the last section, if there is any … … 59 60 groups => \%groups, 60 61 sections => \@sections, 62 ( @submit ? 63 (submit => @submit == 1 ? $submit[0] : \@submit) : 64 () 65 ), 61 66 } 62 67 } … … 106 111 field_line: <skip:'[ \t]*'> ( field | comment | blank ) "\n" 107 112 108 line: <skip:'[ \t]*'> ( title | author | pattern_def | section_head | heading | group_field | field_group | unknown_directive | field | comment | blank ) "\n"113 line: <skip:'[ \t]*'> ( title | author | pattern_def | section_head | heading | submit | group_field | field_group | unknown_directive | field | comment | blank ) /\n+/ 109 114 110 115 title: '!title' /.*/ … … 145 150 146 151 heading: '!head' /.*/ { push @lines, [ 'head', $item[2] ] } 152 153 submit: '!submit' string(s /\s*,\s*/) 154 { 155 #warn scalar(@{ $item[2] }) . ' submit button(s)'; 156 push @submit, @{ $item[2] }; 157 } 147 158 148 159 group_field: '!field' group_name name label(?) … … 243 254 244 255 # for simple multiword values not involving punctuation 245 simple_multiword: <skip:''> /\w[\w\t ]*/ { $item[2] }256 simple_multiword: /\w/ <skip:''> /[\w\t ]*/ { $item[1] . $item[3] } 246 257 247 258 # my attempt at a single-quoted, non-interpolating string 248 259 # where the backslash can escape literal single quotes 249 quoted_string: <skip:''> "'"/(\\'|[^'])*/ "'"260 quoted_string: "'" <skip:''> /(\\'|[^'])*/ "'" 250 261 { $item[3] =~ s/\\'/'/g; $item[3] } 251 262 … … 278 289 unknown_directive: /\!\S*/ /.*/ 279 290 { warn "[Text::Formbuilder] Skipping unknown directive '$item[1]' at input text line $thisline\n"; } 291 292 unknown_block_directive: /\!\S*/ var_name(?) block 293 { warn "[Text::Formbuilder] Skipping unknown block directive '$item[1]' at input text line $thisline\n"; }
Note: See TracChangeset
for help on using the changeset viewer.