Changeset 73 in text-formbuilder
- Timestamp:
- 03/16/05 13:55:22 (20 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Changes
r72 r73 4 4 * added support for fields with 'other' (requires FB 3.02) 5 5 * added support for limited growth 'growable' fields 6 * allow end of field line comments 6 * allow end of field line comments in the formspec 7 7 * addded an external_css option to include external stylesheets 8 * using <fieldset> tags instead of <h2> to mark form sections 9 * group fields can have comments 8 10 9 11 0.09 - 10 Mar 2005 -
trunk/lib/Text/FormBuilder.pm
r72 r73 177 177 $$field{name} = "$$_[1]{name}_$$field{name}"; 178 178 } 179 $_ = [ 'group', { label => $$_[1]{label} || ucfirst(join(' ',split('_',$$_[1]{name}))), group => \@fields } ]; 179 $_ = [ 180 'group', 181 { 182 label => $$_[1]{label} || ucfirst(join(' ',split('_',$$_[1]{name}))), 183 comment => $$_[1]{comment}, 184 group => \@fields, 185 }, 186 ]; 180 187 } 181 188 } … … 526 533 # mark invalid fields 527 534 if ($$_{invalid}) { 528 $OUT .= "<td>$$_{field} $$_{comment} ] . $msg_invalid . q[</td>";535 $OUT .= qq[<td>$$_{field} <span class="comment">$$_{comment}</span> ] . $msg_invalid . q[</td>]; 529 536 } else { 530 $OUT .= qq[<td>$$_{field} $$_{comment}</td>];537 $OUT .= qq[<td>$$_{field} <span class="comment">$$_{comment}</span></td>]; 531 538 } 532 539 … … 546 553 $OUT .= " ] . $msg_invalid . q[" if grep { $$_{invalid} } @group_fields; 547 554 548 $OUT .= qq[ 555 $OUT .= qq[ <span class="comment">$$line[1]{comment}</span></span></td>\n]; 549 556 $OUT .= qq[ </tr>\n]; 550 557 } … … 1180 1187 1181 1188 You can also use groups in normal field lines: 1182 1189 1183 1190 birthday|Your birthday:DATE 1184 1191 1185 1192 The only (currently) supported pieces of a fieldspec that may be used with a 1186 group in this notation are name and label.1193 group in this notation are name, label, and hint. 1187 1194 1188 1195 =head2 Comments … … 1190 1197 # comment ... 1191 1198 1192 Any line beginning with a C<#> is considered a comment. 1199 Any line beginning with a C<#> is considered a comment. Comments can also appear 1200 after any field line. They I<cannot> appear between items in a C<!list>, or on 1201 the same line as any of the directives. 1193 1202 1194 1203 =head1 TODO … … 1207 1216 reset button 1208 1217 1209 Allow comments on group fields (rendered after the all the fields) 1218 Set FB constructor options directly in the formspec (via a C<!fb> or similar 1219 directive). The major issue here would be what format to use to allow for 1220 array/hash refs. 1210 1221 1211 1222 Pieces that wouldn't make sense in a group field: size, row/col, options, -
trunk/lib/Text/FormBuilder/grammar
r68 r73 152 152 group_name: /%[A-Z_]+/ 153 153 154 field_group: name label(?) group_type 155 { 154 field_group: name label(?) hint(?) group_type comment(?) 155 { 156 warn "[$thisline] comment = $item{'hint(?)'}[0]\n" if $item{'hint(?)'}[0]; 156 157 #warn "[$thisline] field $item{name} is $item{group_type}\n"; 157 push @lines, [ 'group', { name => $item{name}, label => $item{'label(?)'}[0], group => $item{group_type} } ]; 158 push @lines, [ 'group', { 159 name => $item{name}, 160 label => $item{'label(?)'}[0], 161 comment => $item{'hint(?)'}[0], 162 group => $item{group_type}, 163 } ]; 158 164 } 159 165
Note: See TracChangeset
for help on using the changeset viewer.