Hi,
I updated the unicode example (see below) in order to show a Date example. This
shows a bug I am having : This works perfectly with Firefox but IE stops the
connection before receiving all the data from the server. Any idea ?
Benoît Galy
Index: unicode/database.sql
===================================================================
--- unicode/database.sql (revision 993)
+++ unicode/database.sql (working copy)
@@ -1,6 +1,7 @@
CREATE TABLE `unicode` (
`id` INTEGER PRIMARY KEY NOT NULL,
-`string` VARCHAR(255)
+`string` VARCHAR(255),
+`date_created` DATETIME
);
-INSERT INTO `unicode` (`id`, `string`) VALUES (1, 'Ungültig');
+INSERT INTO `unicode` (`id`, `string`,`date_created`) VALUES (1,
'Ungültig',DATETIME('NOW'));
Index: unicode/root/forms/index.yml
===================================================================
--- unicode/root/forms/index.yml (revision 993)
+++ unicode/root/forms/index.yml (working copy)
@@ -10,12 +10,19 @@
- Required
- type: Text
- name: db
+ name: string
label: "From the database ->"
- type: Date
- name: date
+ name: date_created
label: "From DateTime::Locale ->"
+ inflators:
+ - type: DateTime
+ parser:
+ strptime: '%d-%m-%Y'
+ strptime:
+ pattern: '%Y-%b-%d'
+
- type: Submit
name: submit
Index: unicode/lib/unicode/Schema/Unicode.pm
===================================================================
--- unicode/lib/unicode/Schema/Unicode.pm (revision 993)
+++ unicode/lib/unicode/Schema/Unicode.pm (working copy)
@@ -5,7 +5,7 @@
use base 'DBIx::Class';
-__PACKAGE__->load_components(qw/ UTF8Columns HTML::FormFu PK::Auto Core /);
+__PACKAGE__->load_components(qw/ InflateColumn::DateTime UTF8Columns
HTML::FormFu PK::Auto Core /);
__PACKAGE__->table("unicode");
@@ -19,6 +19,10 @@
{ data_type => "VARCHAR",
size => 255
},
+ "date_created",
+ { + data_type => "DATETIME",
+ }
);
__PACKAGE__->utf8_columns(qw/ string /);
Index: unicode/lib/unicode/Controller/Root.pm
===================================================================
--- unicode/lib/unicode/Controller/Root.pm (revision 993)
+++ unicode/lib/unicode/Controller/Root.pm (working copy)
@@ -80,15 +80,20 @@
my ( $self, $c ) = @_;
my $form = $c->stash->{form};
+
+ my $result = $c->model('DB')->resultset('Unicode')->find(1);
if ( $form->submitted ) {
- $form->get_field('db')->comment("^ check this submitted value");
+ $form->get_field('string')->comment("^ check this submitted value");
+
+ if ( $form->submitted_and_valid ) {
+ $form->save_to_model( $result );
+ }
}
+ else {
+ $form->defaults_from_model( $result )
+ }
- my $result = $c->model('DB')->resultset('Unicode')->find(1);
-
- $form->get_field('db')->default( $result->string );
-
$c->stash->{template} = 'index.tt';
return;
Index: unicode/unicode.db
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
_______________________________________________
HTML-FormFu mailing list
[email protected]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu