X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F09_AdvancedCRUD%2F09_FormFu.pod;h=855d65314fce432e404ce6fac5f2f4bc9a072238;hp=52225af923ba9e6993e46b4c9d13b990a448c7e8;hb=532433240eb30ab0ea416cd43bfd5bbe70dfa661;hpb=96a8735673ba59a0cdc20672020dffab4d6209de diff --git a/lib/Catalyst/Manual/Tutorial/09_AdvancedCRUD/09_FormFu.pod b/lib/Catalyst/Manual/Tutorial/09_AdvancedCRUD/09_FormFu.pod index 52225af..855d653 100644 --- a/lib/Catalyst/Manual/Tutorial/09_AdvancedCRUD/09_FormFu.pod +++ b/lib/Catalyst/Manual/Tutorial/09_AdvancedCRUD/09_FormFu.pod @@ -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. =head2 Add Action to Display and Save the Form @@ -131,7 +136,7 @@ following method: } # Set the template - $c->stash->{template} = 'books/formfu_create.tt2'; + $c->stash(template => 'books/formfu_create.tt2'); } @@ -219,7 +224,8 @@ Open C in your editor and enter the following: [%# Render the HTML::FormFu Form %] [% form %] -

Return to book list

+

Return to book list

=head2 Add Links for Create and Update via C @@ -239,19 +245,18 @@ use to easily launch our HTML::FormFu-based form. =head2 Test The HTML::FormFu Create Form -Press 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 (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. @@ -402,11 +407,6 @@ for more filter options. =head2 Try Out the Updated Form -Press 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 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 link. =head2 Try Out the Edit/Update Feature -Press 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 and go to the L URL in your browser. Click the "Edit" link next to "Internetworking with TCP/IP Vol. II", change the @@ -585,7 +580,7 @@ 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 and delete the @@ -643,9 +638,13 @@ Apache config files. Kennedy Clark, C -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 +. + +The most recent version of the Catalyst Tutorial can be found at L. -Copyright 2006-2008, Kennedy Clark, under Creative Commons License -(L). +Copyright 2006-2010, Kennedy Clark, under the +Creative Commons Attribution Share-Alike License Version 3.0 +(L).