package Class::DBI::AsForm;
use 5.006;
use strict;
use warnings;
use Class::DBI::Plugin::Type (); # Bug -- column_type returns char for enum cols
# Use column_type in model class instead
use Data::Dumper; # pjs for
use Class::DBI::mysql ();
our $OLD_STYLE = 0;
use HTML::Element;
require Exporter;
our @ISA = qw(Exporter);
# PETER SPELTZ -- Added new "_to_*" methods to @EXPORT
our @EXPORT = qw( to_cgi to_field _to_textarea _to_textfield _to_select
type_of _to_foreign_inputs _to_enum_select _to_bool_select );
our $VERSION = '2.3';
=head1 NAME
Class::DBI::AsForm
Produce HTML form elements for database columns
=head1 SYNOPSIS
package Music::CD;
use Class::DBI::AsForm;
use base 'Class::DBI';
use CGI;
...
sub create_or_edit {
my $class = shift;
my %cgi_field = $class->to_cgi;
return start_form,
(map { "$_: ". $cgi_field{$_}->as_HTML."
" }
$class->Columns),
end_form;
}
#