Changeset 81 in text-formbuilder for trunk/lib/Text
- Timestamp:
- 04/13/05 11:34:05 (20 years ago)
- Location:
- trunk/lib/Text
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder.pm
r80 r81 296 296 title => $self->{form_spec}{title}, 297 297 text => $self->{form_spec}{description}, 298 submit => $self->{form_spec}{submit}, 298 # use 'defined' so we are able to differentiate between 'submit = 0' (no submit button) 299 # and 'submit = undef' (use default submit button) 300 ( defined $self->{form_spec}{submit} ? (submit => $self->{form_spec}{submit}) : () ), 301 reset => $self->{form_spec}{reset}, 299 302 template => { 300 303 type => 'Text', … … 305 308 }, 306 309 data => { 310 #TODO: make FB aware of sections 307 311 sections => $self->{form_spec}{sections}, 308 312 author => $self->{form_spec}{author}, … … 534 538 # mark invalid fields 535 539 if ($$_{invalid}) { 536 $OUT .= qq[<td>$$_{field} <span class="comment">$$_{comment}</span> ] . $msg_invalid . q[</td>];540 $OUT .= qq[<td>$$_{field} <span class="comment">$$_{comment}</span> $$_{error}</td>]; 537 541 } else { 538 542 $OUT .= qq[<td>$$_{field} <span class="comment">$$_{comment}</span></td>]; … … 551 555 $OUT .= qq[ <td><span class="fieldgroup">]; 552 556 $OUT .= join(' ', map { qq[<small class="sublabel">$$_{label}</small> $$_{field} $$_{comment}] } @group_fields); 553 #TODO: allow comments on field groups554 $OUT .= " ] . $msg_invalid . q[" if grep { $$_{invalid} } @group_fields;555 557 if (my @invalid = grep { $$_{invalid} } @group_fields) { 558 $OUT .= ' ' . join('; ', map { $$_{error} } @invalid); 559 } 556 560 $OUT .= qq[ <span class="comment">$$line[1]{comment}</span></span></td>\n]; 557 561 $OUT .= qq[ </tr>\n]; … … 566 570 } 567 571 %> 568 <tr><th></th><td style="padding-top: 1em;"><% $submit %> </td></tr>572 <tr><th></th><td style="padding-top: 1em;"><% $submit %> <% $reset %></td></tr> 569 573 </table> 570 574 </fieldset> … … 965 969 } 966 970 967 !submit button label, button label 2, ... 971 !submit label, label 2, ... 972 973 !reset label 968 974 969 975 =head2 Directives … … 1024 1030 rendered together at the bottom of the form. See L<CGI::FormBuilder> for an 1025 1031 explanation of how the multiple submit buttons work together in a form. 1032 1033 To disable the display of any submit button, use C<!submit 0> 1034 1035 =item C<!reset> 1036 1037 The label for the a reset button at the end of the form. No reset button will be 1038 rendered unless you use this directive. 1026 1039 1027 1040 =back … … 1244 1257 Make sure that multiple runs of the parser don't share data. 1245 1258 1246 Allow renaming and inclusion of a reset button1247 1248 1259 Warn/suggest using the C<!submit> directive if some uses C<foo:submit>? 1249 1260 -
trunk/lib/Text/FormBuilder/grammar
r80 r81 64 64 () 65 65 ), 66 reset => $formspec{reset}, 66 67 } 67 68 } … … 111 112 field_line: <skip:'[ \t]*'> ( field | comment | blank ) "\n" 112 113 113 line: <skip:'[ \t]*'> ( title | author | pattern_def | section_head | heading | submit | group_field | field_group | unknown_directive | field | comment | blank ) /\n+/114 line: <skip:'[ \t]*'> ( title | author | pattern_def | section_head | heading | submit | reset | group_field | field_group | unknown_directive | field | comment | blank ) /\n+/ 114 115 115 116 title: '!title' /.*/ … … 155 156 #warn scalar(@{ $item[2] }) . ' submit button(s)'; 156 157 push @submit, @{ $item[2] }; 158 } 159 160 reset: '!reset' string 161 { 162 warn "[Text::FormBuilder] Reset button redefined at input text line $thisline\n" if defined $formspec{reset}; 163 $formspec{reset} = $item{string}; 157 164 } 158 165
Note: See TracChangeset
for help on using the changeset viewer.