Subject: | When using the "how" parameter of to_field, the input element does not show current value |
Date: | Sun, 13 May 2012 12:57:05 +0200 |
To: | bug-Class-DBI-AsForm [...] rt.cpan.org |
From: | Alain Knaff <alain [...] knaff.lu> |
Hello,
I'm trying to use the Class::DBI::AsForm module to generate form
elements for editing objects stored in a postgres DB.
The declaration is as follows:
create table employee (
id serial primary key,
lastname varchar(255),
firstname varchar(255)
);
... and the Perl class is declared as follows:
package Vacations::Employee;
use base 'Vacations::DBI';
Vacations::Employee->table('employee');
Vacations::Employee->columns(All => qw/id lastname firstname/);
1;
When I do $employee->to_field('lastname') I get a text area, but I'd
prefer to get a text field.
So I used $employee->to_field('lastname','textfield'). Now I do get a
text field, but the current value ("Knaff") is not filled in.
If I declare lastname as char(255) rather than varchar(255) in the
database, I do get a text field, with current value filled in, but I'm
concerned that this may make the table take up more physical space.
Any solution for this?
Thanks,
Alain