.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Catalyst::Manual::Tutorial::09_AdvancedCRUD::09_FormFu 3pm" .TH Catalyst::Manual::Tutorial::09_AdvancedCRUD::09_FormFu 3pm "2013-05-06" "perl v5.18.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Catalyst::Manual::Tutorial::09_AdvancedCRUD::09_FormFu \- Catalyst Tutorial \- Chapter 9: Advanced CRUD \- FormFu .SH "OVERVIEW" .IX Header "OVERVIEW" This is \fBChapter 9 of 10\fR for the Catalyst tutorial. .PP Tutorial Overview .IP "1." 4 Introduction .IP "2." 4 Catalyst Basics .IP "3." 4 More Catalyst Basics .IP "4." 4 Basic \s-1CRUD\s0 .IP "5." 4 Authentication .IP "6." 4 Authorization .IP "7." 4 Debugging .IP "8." 4 Testing .IP "9." 4 \&\fB09_Advanced CRUD::09_FormFu\fR .IP "10." 4 Appendices .SH "DESCRIPTION" .IX Header "DESCRIPTION" This portion of the tutorial explores HTML::FormFu and how it can be used to manage forms, perform validation of form input, as well as save and restore data to/from the database. .PP See Catalyst::Manual::Tutorial::09_AdvancedCRUD for additional form management options other than HTML::FormFu. .PP Source code for the tutorial in included in the \fI/home/catalyst/Final\fR directory of the Tutorial Virtual machine (one subdirectory per chapter). There are also instructions for downloading the code in Catalyst::Manual::Tutorial::01_Intro. .SH "HTML::FormFu FORM CREATION" .IX Header "HTML::FormFu FORM CREATION" This section looks at how HTML::FormFu can be used to add additional functionality to the manually created form from Chapter 4. .SS "Inherit From Catalyst::Controller::HTML::FormFu" .IX Subsection "Inherit From Catalyst::Controller::HTML::FormFu" First, change your \f(CW\*(C`lib/MyApp/Controller/Books.pm\*(C'\fR to inherit from Catalyst::Controller::HTML::FormFu by changing the \f(CW\*(C`extends\*(C'\fR line from the default of: .PP .Vb 1 \& BEGIN {extends \*(AqCatalyst::Controller\*(Aq; } .Ve .PP to use the FormFu base controller class: .PP .Vb 1 \& BEGIN {extends \*(AqCatalyst::Controller::HTML::FormFu\*(Aq; } .Ve .PP Don't forget to add: .PP .Vb 3 \& requires \*(AqHTML::FormFu\*(Aq; \& requires \*(AqCatalyst::Controller::HTML::FormFu\*(Aq; \& requires \*(Aqrequires \*(AqHTML::FormFu::Model::DBIC\*(Aq;\*(Aq; .Ve .PP to your \f(CW\*(C`Makefile.PL\*(C'\fR. .SS "Add Action to Display and Save the Form" .IX Subsection "Add Action to Display and Save the Form" Open \f(CW\*(C`lib/MyApp/Controller/Books.pm\*(C'\fR in your editor and add the following method: .PP .Vb 1 \& =head2 formfu_create \& \& Use HTML::FormFu to create a new book \& \& =cut \& \& sub formfu_create :Chained(\*(Aqbase\*(Aq) :PathPart(\*(Aqformfu_create\*(Aq) :Args(0) :FormConfig { \& my ($self, $c) = @_; \& \& # Get the form that the :FormConfig attribute saved in the stash \& my $form = $c\->stash\->{form}; \& \& # Check if the form has been submitted (vs. displaying the initial \& # form) and if the data passed validation. "submitted_and_valid" \& # is shorthand for "$form\->submitted && !$form\->has_errors" \& if ($form\->submitted_and_valid) { \& # Create a new book \& my $book = $c\->model(\*(AqDB::Book\*(Aq)\->new_result({}); \& # Save the form data for the book \& $form\->model\->update($book); \& # Set a status message for the user & return to books list \& $c\->response\->redirect($c\->uri_for($self\->action_for(\*(Aqlist\*(Aq), \& {mid => $c\->set_status_msg("Book created")})); \& $c\->detach; \& } else { \& # Get the authors from the DB \& my @author_objs = $c\->model("DB::Author")\->all(); \& # Create an array of arrayrefs where each arrayref is an author \& my @authors; \& foreach (sort {$a\->last_name cmp $b\->last_name} @author_objs) { \& push(@authors, [$_\->id, $_\->last_name]); \& } \& # Get the select added by the config file \& my $select = $form\->get_element({type => \*(AqSelect\*(Aq}); \& # Add the authors to it \& $select\->options(\e@authors); \& } \& \& # Set the template \& $c\->stash(template => \*(Aqbooks/formfu_create.tt2\*(Aq); \& } .Ve .SS "Create a Form Config File" .IX Subsection "Create a Form Config File" Although \f(CW\*(C`HTML::FormFu\*(C'\fR supports any configuration file handled by Config::Any, most people tend to use \s-1YAML. \s0 First create a directory to hold your form configuration files: .PP .Vb 1 \& $ mkdir \-p root/forms/books .Ve .PP Then create the file \f(CW\*(C`root/forms/books/formfu_create.yml\*(C'\fR and enter the following text: .PP .Vb 12 \& \-\-\- \& # indicator is the field that is used to test for form submission \& indicator: submit \& # Start listing the form elements \& elements: \& # The first element will be a text field for the title \& \- type: Text \& name: title \& label: Title \& # This is an optional \*(Aqmouse over\*(Aq title pop\-up \& attributes: \& title: Enter a book title here \& \& # Another text field for the numeric rating \& \- type: Text \& name: rating \& label: Rating \& attributes: \& title: Enter a rating between 1 and 5 here \& \& # Add a drop\-down list for the author selection. Note that we will \& # dynamically fill in all the authors from the controller but we \& # could manually set items in the drop\-list by adding this YAML code: \& # options: \& # \- [ \*(Aq1\*(Aq, \*(AqBastien\*(Aq ] \& # \- [ \*(Aq2\*(Aq, \*(AqNasseh\*(Aq ] \& \- type: Select \& name: authors \& label: Author \& \& # The submit button \& \- type: Submit \& name: submit \& value: Submit .Ve .PP \&\fB\s-1NOTE:\s0\fR Copying and pasting \s-1YAML\s0 from Perl documentation is sometimes tricky. See the \*(L"Config::General Config for this tutorial\*(R" section of this document for a more foolproof config format. .SS "Update the \s-1CSS\s0" .IX Subsection "Update the CSS" Edit \f(CW\*(C`root/static/css/main.css\*(C'\fR and add the following lines to the bottom of the file: .PP .Vb 11 \& ... \& input { \& display: block; \& } \& select { \& display: block; \& } \& .submit { \& padding\-top: .5em; \& display: block; \& } .Ve .PP These changes will display form elements vertically. .SS "Create a Template Page To Display The Form" .IX Subsection "Create a Template Page To Display The Form" Open \f(CW\*(C`root/src/books/formfu_create.tt2\*(C'\fR in your editor and enter the following: .PP .Vb 1 \& [% META title = \*(AqCreate/Update Book\*(Aq %] \& \& [%# Render the HTML::FormFu Form %] \& [% form %] \& \&

Return to book list

.Ve .ie n .SS "Add Links for Create and Update via ""HTML::FormFu""" .el .SS "Add Links for Create and Update via \f(CWHTML::FormFu\fP" .IX Subsection "Add Links for Create and Update via HTML::FormFu" Open \f(CW\*(C`root/src/books/list.tt2\*(C'\fR in your editor and add the following to the bottom of the existing file: .PP .Vb 5 \& ... \&

\& HTML::FormFu: \& Create \&

.Ve .PP This adds a new link to the bottom of the book list page that we can use to easily launch our HTML::FormFu\-based form. .SS "Test The HTML::FormFu Create Form" .IX Subsection "Test The HTML::FormFu Create Form" Make sure the server is running with the \*(L"\-r\*(R" restart option: .PP .Vb 1 \& $ script/myapp_server.pl \-r .Ve .PP Login as \f(CW\*(C`test01\*(C'\fR (password: mypass). Once at the Book List page, click the new HTML::FormFu \*(L"Create\*(R" link at the bottom to display the form. Fill in the following values: .PP .Vb 3 \& Title: Internetworking with TCP/IP Vol. II \& Rating: 4 \& Author: Comer .Ve .PP Click the \*(L"Submit\*(R" button, and you will be returned to the Book List page with a \*(L"Book created\*(R" status message displayed. .PP Also note that this implementation allows you to create books with any bogus information. Although we have constrained the authors with the drop-down list (note that this isn't bulletproof because we still have not prevented a user from \*(L"hacking\*(R" the form to specify other values), there are no restrictions on items such as the length of the title (for example, you can create a one-letter title) and the value of the rating (you can use any number you want, and even non-numeric values with SQLite). The next section will address this concern. .PP \&\fBNote:\fR Depending on the database you are using and how you established the columns in your tables, the database could obviously provide various levels of \*(L"type enforcement\*(R" on your data. The key point being made in the previous paragraph is that the \fIweb application\fR itself is not performing any validation. .SH "HTML::FormFu VALIDATION AND FILTERING" .IX Header "HTML::FormFu VALIDATION AND FILTERING" Although the use of HTML::FormFu in the previous section did provide an automated mechanism to build the form, the real power of this module stems from functionality that can automatically validate and filter the user input. Validation uses constraints to be sure that users input appropriate data (for example, that the email field of a form contains a valid email address). Filtering can also be used to remove extraneous whitespace from fields or to escape meta-characters in user input. .SS "Add Constraints" .IX Subsection "Add Constraints" Open \f(CW\*(C`root/forms/books/formfu_create.yml\*(C'\fR in your editor and update it to match: .PP .Vb 10 \& \-\-\- \& # indicator is the field that is used to test for form submission \& indicator: submit \& # Start listing the form elements \& elements: \& # The first element will be a text field for the title \& \- type: Text \& name: title \& label: Title \& # This is an optional \*(Aqmouse over\*(Aq title pop\-up \& attributes: \& title: Enter a book title here \& # Add constraints for the field \& constraints: \& # Force the length to be between 5 and 40 chars \& \- type: Length \& min: 5 \& max: 40 \& # Override the default of \*(AqInvalid input\*(Aq \& message: Length must be between 5 and 40 characters \& \& # Another text field for the numeric rating \& \- type: Text \& name: rating \& label: Rating \& attributes: \& title: Enter a rating between 1 and 5 here \& # Use Filter to clean up the input data \& # Could use \*(AqNonNumeric\*(Aq below, but since Filters apply *before* \& # constraints, it would conflict with the \*(AqInteger\*(Aq constraint below. \& # So let\*(Aqs skip this and just use the constraint. \& #filter: \& # Remove everything except digits \& #\- NonNumeric \& # Add constraints to the field \& constraints: \& # Make sure it\*(Aqs a number \& \- type: Integer \& message: "Required. Digits only, please." \& # Check the min & max values \& \- type: Range \& min: 1 \& max: 5 \& message: "Must be between 1 and 5." \& \& # Add a select list for the author selection. Note that we will \& # dynamically fill in all the authors from the controller but we \& # could manually set items in the select by adding this YAML code: \& # options: \& # \- [ \*(Aq1\*(Aq, \*(AqBastien\*(Aq ] \& # \- [ \*(Aq2\*(Aq, \*(AqNasseh\*(Aq ] \& \- type: Select \& name: authors \& label: Author \& # Convert the drop\-down to a multi\-select list \& multiple: 1 \& # Display 3 entries (user can scroll to see others) \& size: 3 \& # One could argue we don\*(Aqt need to do filters or constraints for \& # a select list, but it\*(Aqs smart to do validation and sanity \& # checks on this data in case a user "hacks" the input \& # Add constraints to the field \& constraints: \& # Make sure it\*(Aqs a number \& \- Integer \& \& # The submit button \& \- type: Submit \& name: submit \& value: Submit \& \& # Global filters and constraints. \& constraints: \& # The user cannot leave any fields blank \& \- Required \& # If not all fields are required, move the Required constraint to the \& # fields that are \& filter: \& # Remove whitespace at both ends \& \- TrimEdges \& # Escape HTML characters for safety \& \- HTMLEscape .Ve .PP \&\fB\s-1NOTE:\s0\fR Copying and pasting \s-1YAML\s0 from Perl documentation is sometimes tricky. See the \*(L"Config::General Config for this tutorial\*(R" section of this document for a more foolproof config format. .PP The main changes are: .IP "\(bu" 4 The \f(CW\*(C`Select\*(C'\fR element for \f(CW\*(C`authors\*(C'\fR is changed from a single-select drop-down to a multi-select list by adding configuration for the \&\f(CW\*(C`multiple\*(C'\fR and \f(CW\*(C`size\*(C'\fR options in \f(CW\*(C`formfu_create.yml\*(C'\fR. .IP "\(bu" 4 Constraints are added to provide validation of the user input. See HTML::FormFu::Constraint for other constraints that are available. .IP "\(bu" 4 A variety of filters are run on every field to remove and escape unwanted input. See HTML::FormFu::Filter for more filter options. .SS "Try Out the Updated Form" .IX Subsection "Try Out the Updated Form" Make sure you are still logged in as \f(CW\*(C`test01\*(C'\fR and try adding a book with various errors: title less than 5 characters, non-numeric rating, a rating of 0 or 6, etc. Also try selecting one, two, and zero authors. When you click Submit, the HTML::FormFu \f(CW\*(C`constraint\*(C'\fR items will validate the logic and insert feedback as appropriate. Try adding blank spaces at the front or the back of the title and note that it will be removed. .PP Note that you can update your FormFu \s-1YAML\s0 forms and the development server does not need to reload \*(-- the form definition is read from the \s-1YAML\s0 file each time a controller action uses it. .SH "CREATE AND UPDATE/EDIT ACTION" .IX Header "CREATE AND UPDATE/EDIT ACTION" Let's expand the work done above to add an edit action. First, open \&\f(CW\*(C`lib/MyApp/Controller/Books.pm\*(C'\fR and add the following method to the bottom: .PP .Vb 1 \& =head2 formfu_edit \& \& Use HTML::FormFu to update an existing book \& \& =cut \& \& sub formfu_edit :Chained(\*(Aqobject\*(Aq) :PathPart(\*(Aqformfu_edit\*(Aq) :Args(0) \& :FormConfig(\*(Aqbooks/formfu_create.yml\*(Aq) { \& my ($self, $c) = @_; \& \& # Get the specified book already saved by the \*(Aqobject\*(Aq method \& my $book = $c\->stash\->{object}; \& \& # Make sure we were able to get a book \& unless ($book) { \& # Set an error message for the user & return to books list \& $c\->response\->redirect($c\->uri_for($self\->action_for(\*(Aqlist\*(Aq), \& {mid => $c\->set_error_msg("Invalid book \-\- Cannot edit")})); \& $c\->detach; \& } \& \& # Get the form that the :FormConfig attribute saved in the stash \& my $form = $c\->stash\->{form}; \& \& # Check if the form has been submitted (vs. displaying the initial \& # form) and if the data passed validation. "submitted_and_valid" \& # is shorthand for "$form\->submitted && !$form\->has_errors" \& if ($form\->submitted_and_valid) { \& # Save the form data for the book \& $form\->model\->update($book); \& # Set a status message for the user \& # Set a status message for the user & return to books list \& $c\->response\->redirect($c\->uri_for($self\->action_for(\*(Aqlist\*(Aq), \& {mid => $c\->set_status_msg("Book edited")})); \& $c\->detach; \& } else { \& # Get the authors from the DB \& my @author_objs = $c\->model("DB::Author")\->all(); \& # Create an array of arrayrefs where each arrayref is an author \& my @authors; \& foreach (sort {$a\->last_name cmp $b\->last_name} @author_objs) { \& push(@authors, [$_\->id, $_\->last_name]); \& } \& # Get the select added by the config file \& my $select = $form\->get_element({type => \*(AqSelect\*(Aq}); \& # Add the authors to it \& $select\->options(\e@authors); \& # Populate the form with existing values from DB \& $form\->model\->default_values($book); \& } \& \& # Set the template \& $c\->stash(template => \*(Aqbooks/formfu_create.tt2\*(Aq); \& } .Ve .PP Most of this code should look familiar to what we used in the \&\f(CW\*(C`formfu_create\*(C'\fR method (in fact, we should probably centralize some of the common code in separate methods). The main differences are: .IP "\(bu" 4 We have to manually specify the name of the FormFu .yml file as an argument to \f(CW\*(C`:FormConfig\*(C'\fR because the name can no longer be automatically deduced from the name of our action/method (by default, FormFu would look for a file named \f(CW\*(C`books/formfu_edit.yml\*(C'\fR). .IP "\(bu" 4 We load the book object from the stash (found using the \f(CW$id\fR passed to the Chained object method) .IP "\(bu" 4 We use \f(CW$id\fR to look up the existing book from the database. .IP "\(bu" 4 We make sure the book lookup returned a valid book. If not, we set the error message and return to the book list. .IP "\(bu" 4 If the form has been submitted and passes validation, we skip creating a new book and just use \f(CW\*(C`$form\->model\->update\*(C'\fR to update the existing book. .IP "\(bu" 4 If the form is being displayed for the first time (or has failed validation and it being redisplayed), we use \&\f(CW\*(C`$form\->model\->default_values\*(C'\fR to populate the form with data from the database. .PP Then, edit \f(CW\*(C`root/src/books/list.tt2\*(C'\fR and add a new link below the existing \*(L"Delete\*(R" link that allows us to edit/update each existing book. The last cell in the book list table should look like the following: .PP .Vb 10 \& ... \& \& [% # Add a link to delete a book %] \& Delete \& [% # Add a link to edit a book %] \& Edit \& \& ... .Ve .PP \&\fBNote:\fR Only add three lines (the \*(L"Add a link to edit a book\*(R" comment and the href for \f(CW\*(C`formfu_edit\*(C'\fR). Make sure you add it below the existing \&\f(CW\*(C`delete\*(C'\fR link. .SS "Try Out the Edit/Update Feature" .IX Subsection "Try Out the Edit/Update Feature" Make sure you are still logged in as \f(CW\*(C`test01\*(C'\fR and go to the \s-1URL\s0 in your browser. Click the \&\*(L"Edit\*(R" link next to \*(L"Internetworking with \s-1TCP/IP\s0 Vol. \s-1II\*(R",\s0 change the rating to a 3, the \*(L"\s-1II\*(R"\s0 at end of the title to the number \*(L"2\*(R", add Stevens as a co-author (control-click), and click Submit. You will then be returned to the book list with a \*(L"Book edited\*(R" message at the top in green. Experiment with other edits to various books. .SS "More Things to Try" .IX Subsection "More Things to Try" You are now armed with enough knowledge to be dangerous. You can keep tweaking the example application; some things you might want to do: .IP "\(bu" 4 Add an appropriate authorization check to the new Edit function. .IP "\(bu" 4 Cleanup the List page so that the Login link only displays when the user isn't logged in and the Logout link only displays when a user is logged in. .IP "\(bu" 4 Add a more sensible policy for when and how users and admins can do things in the \s-1CRUD\s0 cycle. .IP "\(bu" 4 Support the \s-1CRUD\s0 cycle for authors. .PP Or you can proceed to write your own application, which is probably the real reason you worked through this Tutorial in the first place. .SS "Config::General Config for this tutorial" .IX Subsection "Config::General Config for this tutorial" If you are having difficulty with \s-1YAML\s0 config above, please save the below into the file \f(CW\*(C`formfu_create.conf\*(C'\fR and delete the \&\f(CW\*(C`formfu_create.yml\*(C'\fR file. The below is in Config::General format which follows the syntax of Apache config files. .PP .Vb 10 \& constraints Required \& \& \& min 5 \& max 40 \& type Length \& message Length must be between 5 and 40 characters \& \& filter TrimEdges \& filter HTMLEscape \& name title \& type Text \& label Title \& \& title Enter a book title here \& \& \& \& constraints Integer \& filter TrimEdges \& filter NonNumeric \& name rating \& type Text \& label Rating \& \& title Enter a rating between 1 and 5 here \& \& \& \& constraints Integer \& filter TrimEdges \& filter HTMLEscape \& name authors \& type Select \& label Author \& multiple 1 \& size 3 \& \& \& value Submit \& name submit \& type Submit \& \& indicator submit .Ve .SH "AUTHOR" .IX Header "AUTHOR" Kennedy Clark, \f(CW\*(C`hkclark@gmail.com\*(C'\fR .PP Feel free to contact the author for any errors or suggestions, but the best way to report issues is via the \s-1CPAN RT\s0 Bug system at . .PP Copyright 2006\-2011, Kennedy Clark, under the Creative Commons Attribution Share-Alike License Version 3.0 ().