View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Devin Austin > Form-Sensible-Reflector-DBIC-0.349 > Form::Sensible::Reflector::DBIC



Annotate this POD


Open  1
View/Report Bugs
Module Version: 0.349   Source  


Form::Sensible::Reflector::DBIC - A reflector class based on Form::Sensible and Form::Sensible::Reflector


version 0.349


        my $schema = TestSchema->connect('dbi:SQLite::memory:');
        use Form::Sensible;
        use Form::Sensible::Reflector::DBIC;
        ## name must reflect the table which we are reflecting

        my $dt = DateTime->now;

        my $reflector = Form::Sensible::Reflector::DBIC->new();
        my $form      = $reflector->reflect_from(
                form   => { name => 'test' },
                 with_trigger => 1
        my $renderer = Form::Sensible->get_renderer('HTML');

        $form->set_values( { date => $dt } );
        my $output = $renderer->render($form)->complete;


Form::Sensible::Reflector::DBIC was designed with the intention that as much configuration as possible can be done in the definition of the DBIx::Class::ResultSource objects. While the ResultSource definition is used to programatically generate as much of the Form::Sensible::Field definitions as possible, it is possible to add to the Field generated. This is done with several items that can be added to the columinfo hash in the call to add_columns():


The validation hashref is used just as the validation hashref atribute in Form::Sensible::Field. It is typically used by Form::Sensible::Validator in order to create validation rules for form input values. As specified by Form::Sensible::Validator, it can contain keys required, code, and regex.


The render_hints hashref also gets passed to Form::Sensible::Field as the render_hints attribute to the create_from_flattened constructor.


The fs_definition hashref can be used to completely override the intelligence ordinarily used to generate the Form::Sensible::Field definition. If this hashref is present, each key in it is used to completely overwrite the key in the Form::Sensible::Field definition. Any of the attributes accepted by Form::Sensible::Field are acceptable here. Note that one could alternatively specify validation and render_hints options here.

For example:

            data_type         => 'integer',
            is_auto_increment => 1,
            is_nullable       => 0
            data_type  => 'varchar',
            validation => { regex => qr/[-\d]+/ }, # passed to Form::Sensible::Field
    __PACKAGE__->set_primary_key('id');  # Defaults to hidden in the form



Hashref of the supported DBMS type->form element translations.


Default options for Form::Sensible field classes.

$self->get_base_definition($name, $datatype)

This gets field definitions for a given datatype and returns them in hashref form.


Get field names for the form, for example, the column names in the table.


Get a given field's definition.


Devin Austin <>
Jay Kuri <>
Andrew Moore <>
syntax highlighting: