X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FAdvancedCRUD%2FFormFu.pod;h=80c872ca6290f8e903a3dad57f9a3dcbe2ebc5c1;hp=9c42115a663c0d413c75432b2ae402e857054112;hb=aee2748332aed431f3c342d3dc2956c0ceb2b1ea;hpb=ab0db558e3e94c4158d0b5ca9702c1832c260f53 diff --git a/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod b/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod index 9c42115..80c872c 100644 --- a/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod +++ b/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod @@ -61,7 +61,7 @@ L This portion of the tutorial explores L 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.03006. +using HTML::FormFu version 0.03007. See L @@ -83,6 +83,10 @@ required by C: libregexp-copy-perl libregexp-common-perl libyaml-syck-perl libparams-util-perl \ libcrypt-des-perl libcaptcha-recaptcha-perl libcrypt-cbc-perl \ libreadonly-xs-perl libmoose-perl libregexp-assemble-perl + + ... + + sudo apt-get clean Then use the following command to install directly from CPAN the modules that aren't available as Ubuntu/Debian packages via C: @@ -91,6 +95,13 @@ that aren't available as Ubuntu/Debian packages via C: boolean Test::MockTime DateTime::Format::Natural HTML::FormFu \ Catalyst::Component::InstancePerContext Catalyst::Controller::HTML::FormFu \ HTML::FormFu::Model::DBIC + + ... + + Is it OK to try to connect to the Internet? [yes] yes + + ... + B If you are following along with the Ubuntu LiveCD, you might want to make sure you still have adequate free disk space in the root @@ -141,7 +152,7 @@ following method: # Create a new book my $book = $c->model('DB::Books')->new_result({}); # Save the form data for the book - $form->save_to_model($book); + $form->model->update($book); # Set a status message for the user $c->flash->{status_msg} = 'Book created'; # Return to the books list @@ -474,7 +485,7 @@ bottom: # is shorthand for "$form->submitted && !$form->has_errors" if ($form->submitted_and_valid) { # Save the form data for the book - $form->save_to_model($book); + $form->model->update($book); # Set a status message for the user $c->flash->{status_msg} = 'Book edited'; # Return to the books list @@ -493,7 +504,7 @@ bottom: # Add the authors to it $select->options(\@authors); # Populate the form with existing values from DB - $form->defaults_from_model($book); + $form->model->default_values($book); } # Set the template @@ -522,14 +533,14 @@ we set the error message and return to the book list. =item * If the form has been submitted and passes validation, we skip creating a -new book and just use C<$form-Esave_to_model> to update the existing +new book and just use C<$form-Emodel-Eupdate> to update the existing book. =item * If the form is being displayed for the first time (or has failed validation and it being redisplayed), we use - C<$form-Edefault_from_model> to populate the form with data from the + C<$form-Emodel-Edefault_values> to populate the form with data from the database. =back @@ -568,6 +579,36 @@ Stevens as a co-author (control-click), and click Submit. You will then be returned to the book list with a "Book edited" message at the top in green. Experiment with other edits to various books. +=head2 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: + +=over 4 + +=item * + +Add an appropriate ACL to the new Edit function. + +=item * + +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. + +=item * + +Add a more sensible policy for when and how users and admins can do +things in the CRUD cycle. + +=item * + +Support the CRUD cycle for authors. + +=back + +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 @@ -630,8 +671,7 @@ 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 -L. +L. -Copyright 20066-2008, Kennedy Clark, under Creative Commons License -(L). - +Copyright 2006-2008, Kennedy Clark, under Creative Commons License +(L).