Changeset 38 in text-formbuilder for trunk/lib/Text
- Timestamp:
- 12/06/04 14:22:54 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder.pm
r35 r38 6 6 use vars qw($VERSION); 7 7 8 $VERSION = '0.0 6';8 $VERSION = '0.07_01'; 9 9 10 10 use Carp; … … 100 100 101 101 # css, extra_css: allow for custom inline stylesheets 102 # neat trick: extra_css => '@import(my_external_stylesheet.css);'102 # neat trick: css => '@import(my_external_stylesheet.css);' 103 103 # will let you use an external stylesheet 104 104 # CSS Hint: to get multiple sections to all line up their fields, … … 109 109 110 110 # messages 111 # code pulled (with modifications) from CGI::FormBuilder 111 112 if ($options{messages}) { 112 113 # if its a hashref, we'll just pass it on to CGI::FormBuilder … … 213 214 } 214 215 215 # TODO: configurable threshold for this216 216 foreach (@{ $self->{form_spec}{fields} }) { 217 217 $$_{ulist} = 1 if ref $$_{options} and @{ $$_{options} } >= 3; … … 527 527 =head1 DESCRIPTION 528 528 529 This module is intended to extend the idea of making it easy to create 530 web forms by allowing you to describe them with a simple langauge. These 531 I<formspecs> are then passed through this module's parser and converted 532 into L<CGI::FormBuilder> objects that you can easily use in your CGI 533 scripts. In addition, this module can generate code for standalone modules 534 which allow you to separate your form design from your script code. 535 536 A simple formspec looks like this: 537 538 name//VALUE 539 email//EMAIL 540 langauge:select{English,Spanish,French,German} 541 moreinfo|Send me more information:checkbox 542 interests:checkbox{Perl,karate,bass guitar} 543 544 This will produce a required C<name> test field, a required C<email> text 545 field that must look like an email address, an optional select dropdown 546 field C<langauge> with the choices English, Spanish, French, and German, 547 an optional C<moreinfo> checkbox labeled ``Send me more information'', and 548 finally a set of checkboxes named C<interests> with the choices Perl, 549 karate, and bass guitar. 550 529 551 =head2 new 552 553 my $parser = Text::FormBuilder->new; 530 554 531 555 =head2 parse … … 573 597 appended to the CSS. If both options are given, then the CSS that is 574 598 used will be C<css> concatenated with C<extra_css>. 599 600 If you want to use an external stylesheet, a quick way to get this is 601 to set the C<css> parameter to import your file: 602 603 css => '@import(my_external_stylesheet.css);' 575 604 576 605 =item C<messages>
Note: See TracChangeset
for help on using the changeset viewer.