Go from L<Module::Name|Module::Name> to L<Module::Name>
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Tutorial / 09_AdvancedCRUD / 09_FormFu.pod
index 52225af..a566e92 100644 (file)
@@ -56,27 +56,27 @@ L<Appendices|Catalyst::Manual::Tutorial::10_Appendices>
 
 =head1 DESCRIPTION
 
-This portion of the tutorial explores L<HTML::FormFu|HTML::FormFu> and 
+This portion of the tutorial explores L<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.  This was written
 using HTML::FormFu version 0.05001.
 
 See 
-L<Catalyst::Manual::Tutorial::09_AdvancedCRUD|Catalyst::Manual::Tutorial::09_AdvancedCRUD>
+L<Catalyst::Manual::Tutorial::09_AdvancedCRUD>
 for additional form management options other than 
-L<HTML::FormFu|HTML::FormFu>.
+L<HTML::FormFu>.
 
 
 =head1 HTML::FormFu FORM CREATION
 
-This section looks at how L<HTML::FormFu|HTML::FormFu> can be used to 
+This section looks at how L<HTML::FormFu> can be used to 
 add additional functionality to the manually created form from Chapter 4.
 
 
 =head2 Inherit From Catalyst::Controller::HTML::FormFu
 
 First, change your C<lib/MyApp/Controller/Books.pm> to inherit from
-L<Catalyst::Controller::HTML::FormFu|Catalyst::Controller::HTML::FormFu>
+L<Catalyst::Controller::HTML::FormFu>
 by changing the C<extends> line from the default of:
 
     BEGIN {extends 'Catalyst::Controller'; }
@@ -85,6 +85,11 @@ to use the FormFu base controller class:
 
     BEGIN {extends 'Catalyst::Controller::HTML::FormFu'; }
 
+Don't forget to add:
+
+    requires 'Catalyst::Controller::HTML::FormFu';
+
+to your C<Makefile.PL>.
 
 =head2 Add Action to Display and Save the Form
 
@@ -131,14 +136,14 @@ following method:
         }
         
         # Set the template
-        $c->stash->{template} = 'books/formfu_create.tt2';
+        $c->stash(template => 'books/formfu_create.tt2');
     }
 
 
 =head2 Create a Form Config File
 
 Although C<HTML::FormFu> supports any configuration file handled by
-L<Config::Any|Config::Any>, most people tend to use YAML.  First
+L<Config::Any>, most people tend to use YAML.  First
 create a directory to hold your form configuration files:
 
     mkdir -p root/forms/books
@@ -219,7 +224,8 @@ Open C<root/src/books/formfu_create.tt2> in your editor and enter the following:
     [%# Render the HTML::FormFu Form %]
     [% form %]
     
-    <p><a href="[% c.uri_for(c.controller.action_for('list')) %]">Return to book list</a></p>
+    <p><a href="[% c.uri_for(c.controller.action_for('list')) 
+        %]">Return to book list</a></p>
 
 
 =head2 Add Links for Create and Update via C<HTML::FormFu>
@@ -239,19 +245,18 @@ use to easily launch our HTML::FormFu-based form.
 
 =head2 Test The HTML::FormFu Create Form
 
-Press C<Ctrl-C> to kill the previous server instance (if it's still
-running) and restart it:
+Make sure the server is running with the "-r" restart option:
 
-    $ script/myapp_server.pl
+    $ script/myapp_server.pl -r
 
 Login as C<test01> (password: mypass).  Once at the Book List page,
 click the new HTML::FormFu "Create" link at the bottom to display the
 form.  Fill in the following values:
 
-Title:  Internetworking with TCP/IP Vol. II
-Rating: 4
-Author: Comer
-    
+    Title:  Internetworking with TCP/IP Vol. II
+    Rating: 4
+    Author: Comer
+
 Click the Submit button, and you will be returned to the Book List page
 with a "Book created" status message displayed.
 
@@ -273,7 +278,7 @@ performing any validation.
 
 =head1 HTML::FormFu VALIDATION AND FILTERING
 
-Although the use of L<HTML::FormFu|HTML::FormFu> in the previous section 
+Although the use of L<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 
@@ -388,13 +393,13 @@ C<multiple> and C<size> options in C<formfu_create.yml>.
 =item *
 
 Constraints are added to provide validation of the user input.  See
-L<HTML::FormFu::Constraint|HTML::FormFu::Constraint> for other
+L<HTML::FormFu::Constraint> for other
 constraints that are available.
 
 =item *
 
 A variety of filters are run on every field to remove and escape 
-unwanted input.  See L<HTML::FormFu::Filter|HTML::FormFu::Filter>
+unwanted input.  See L<HTML::FormFu::Filter>
 for more filter options.
 
 =back
@@ -402,11 +407,6 @@ for more filter options.
 
 =head2 Try Out the Updated Form
 
-Press C<Ctrl-C> to kill the previous server instance (if it's still 
-running) and restart it:
-
-    $ script/myapp_server.pl
-
 Make sure you are still logged in as C<test01> 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. 
@@ -473,7 +473,7 @@ bottom:
         }
     
         # Set the template
-        $c->stash->{template} = 'books/formfu_create.tt2';
+        $c->stash(template => 'books/formfu_create.tt2');
     }
 
 Most of this code should look familiar to what we used in the 
@@ -539,11 +539,6 @@ existing C<delete> link.
 
 =head2 Try Out the Edit/Update Feature
 
-Press C<Ctrl-C> to kill the previous server instance (if it's still 
-running) and restart it:
-
-    $ script/myapp_server.pl
-
 Make sure you are still logged in as C<test01> and go to the 
 L<http://localhost:3000/books/list> URL in your browser.  Click the 
 "Edit" link next to "Internetworking with TCP/IP Vol. II", change the 
@@ -585,12 +580,12 @@ Or you can proceed to write your own application, which is probably the
 real reason you worked through this Tutorial in the first place.
 
 
-=head2  Config::General Config for this tutorial
+=head2 Config::General Config for this tutorial
 
 If you are having difficulty with YAML config above, please save the
 below into the file C<formfu_create.conf> and delete the
 C<formfu_create.yml> file.  The below is in
-L<Config::General|Config::General> format which follows the syntax of
+L<Config::General> format which follows the syntax of
 Apache config files.
 
    constraints   Required
@@ -643,9 +638,13 @@ Apache config files.
 
 Kennedy Clark, C<hkclark@gmail.com>
 
-Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catalyst Tutorial can be found at
+Feel free to contact the author for any errors or suggestions, but the
+best way to report issues is via the CPAN RT Bug system at
+<https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Manual>.
+
+The most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Manual/5.80/trunk/lib/Catalyst/Manual/Tutorial/>.
 
-Copyright 2006-2008, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).    
+Copyright 2006-2010, Kennedy Clark, under the
+Creative Commons Attribution Share-Alike License Version 3.0
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).