Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dbix::class::htmlwidget(3pm) [debian man page]

DBIx::Class::HTMLWidget(3pm)				User Contributed Perl Documentation			      DBIx::Class::HTMLWidget(3pm)

NAME
DBIx::Class::HTMLWidget - Like FromForm but with DBIx::Class and HTML::Widget SYNOPSIS
You'll need a working DBIx::Class setup and some knowledge of HTML::Widget and Catalyst. If you have no idea what I'm talking about, check the (sparse) docs of those modules. package My::Model::DBIC::Pet; use base 'DBIx::Class'; __PACKAGE__->load_components(qw/HTMLWidget Core/); package My::Controller::Pet; # Catalyst-style # define the widget in a sub (DRY) sub widget_pet { my ($self,$c)=@_; my $w=$c->widget('pet')->method('get'); $w->element('Textfield','name')->label('Name'); $w->element('Textfield','age')->label('Age'); ... return $w; } # this renders an edit form with values filled in from the DB sub edit : Local { my ($self,$c,$id)=@_; # get the object my $item=$c->model('DBIC::Pet')->find($id); $c->stash->{item}=$item; # get the widget my $w=$self->widget_pet($c); $w->action($c->uri_for('do_edit/'.$id)); # fill widget with data from DB $item->fill_widget($w); } sub do_edit : Local { my ($self,$c,$id)=@_; # get the object from DB my $item=$c->model('DBIC::Pet')->find($id); $c->stash->{item}=$item; # get the widget my $w=$self->widget_pet($c); $w->action($c->uri_for('do_edit/'.$id)); # process the form parameters my $result = $w->process($c->req); $c->stash->{'result'}=$result; # if there are no errors save the form values to the object unless ($result->has_errors) { $item->populate_from_widget($result); $c->res->redirect('/users/pet/'.$id); } } DESCRIPTION
Something like Class::DBI::FromForm / Class::DBI::FromCGI but using HTML::Widget for form creation and validation and DBIx::Class as a ORM. Methods fill_widget $dbic_object->fill_widget($widget); Fill the values of a widgets elements with the values of the DBIC object. populate_from_widget my $obj=$schema->resultset('pet)->new->populate_from_widget($result); my $item->populate_from_widget($result); Create or update a DBIx::Class row from a HTML::Widget::Result object CAEVATS
/ POSSIBLE PROBLEMS PostgreSQL ERROR: null value in column "private" violates not-null constraint This is a result of we trying to set a value to undef that should not be. This is typicaly a problem when you have a colum such ass "private boolean not null". We have a special-case for this, and if you set data_type => boolean, is_nullable => 0 in your ResultSource definition, we update the value to 0 before attempting to insert or update AUTHORS
Thomas Klausner, <domm@cpan.org>, http://domm.zsi.at Marcus Ramberg, <mramberg@cpan.org> Andreas Marienborg, <omega@palle.net> CONTRIBUTORS
Simon Elliott, <cpan@browsing.co.uk> Ashley Berlin Guillermo Sansovic LICENSE
This code is Copyright (c) 2003-2006 Thomas Klausner. All rights reserved. You may use and distribute this module according to the same terms that Perl is distributed under. perl v5.10.0 2008-02-06 DBIx::Class::HTMLWidget(3pm)

Check Out this Related Man Page

DBIx::Class::Manual::DocMap(3)				User Contributed Perl Documentation			    DBIx::Class::Manual::DocMap(3)

NAME
DBIx::Class::Manual::DocMap - What documentation do we have? Manuals DBIx::Class::Manual - User's Manual overview. DBIx::Class::Manual::QuickStart - Up and running with DBIC in 10 minutes. DBIx::Class::Manual::Intro - More detailed introduction to setting up and using DBIx::Class. DBIx::Class::Manual::SQLHackers - How to use DBIx::Class if you know SQL (external, available on CPAN) DBIx::Class::Manual::Joining - Joining tables with DBIx::Class. DBIx::Class::Manual::Features - A boatload of DBIx::Class features with links to respective documentation. DBIx::Class::Manual::Glossary - What do all those terms mean? DBIx::Class::Manual::Cookbook - Various short recipes on how to do things. DBIx::Class::Manual::FAQ - Frequently Asked Questions, gathered from IRC and the mailing list. DBIx::Class::Manual::Troubleshooting - What to do if things go wrong (diagnostics of known error messages). Some essential reference documentation The first two list items are the most important. "search" in DBIx::Class::ResultSet - Selecting and manipulating sets. The DSL (mini-language) for query composition is only partially explained there, see "WHERE CLAUSES" in SQL::Abstract for the complete details. $schema::Result::$resultclass - Classes representing a single result (row) from a DB query. Such classes normally subclass DBIx::Class::Core, the methods inherited from DBIx::Class::Row and DBIx::Class::Relationship::Base are used most often. DBIx::Class::ResultSetColumn - Perform operations on a single column of a ResultSet. DBIx::Class::ResultSource - Source/Table definition functions. DBIx::Class::Schema - Overall sources, and connection container. DBIx::Class::Relationship - Simple relationship declarations. DBIx::Class::Relationship::Base - Relationship declaration details. DBIx::Class::InflateColumn - Making objects out of your column values. perl v5.18.2 2014-01-05 DBIx::Class::Manual::DocMap(3)
Man Page