I like the idea about 'null_if_empty' option. I think it will work just fine for me. :) Is it possible to include this small fix to the next release?

15.06.2011 15:08, Peter Shangov пишет:
OK, my oversight.

H::FF::M::DBIC does roughly the following check to determine whether a field's 
value should be set to NULL:

   if ( $is_nullable&&  $data_type =~ m/^timestamp|date|int|float|numeric/i ) { 
... }

I am not sure why the second check is there, but I am sure there is a good 
reason for it, so I would not change it.

If an option 'null_if_empty' is added for fields, and it forces the field's 
value to be set to NULL regardless of the data type, would that work for you?

Cheers,

--
Peter


----- Original Message -----
From: Dmitry Bigunyak<ices...@inbox.ru>
To: "HTML Form Creation, Rendering and Validation 
Framework"<html-formfu@lists.scsys.co.uk>
Cc:
Sent: Wednesday, 15 June 2011, 12:22
Subject: Re: [html-formfu] Model::DBIC inserts empty strings instead of NULL 
values

Hi Peter,
In my initial post I've written about this option:
  I thought about using ignore_if_empty option, but I lose ability to
unset the column value to NULL with it.

thanks for your reply

15.06.2011 13:12, Peter Shangov пишет:
  Dmitry, Alex,

  There is an undocumented option 'ignore_if_empty' for columns,
which instructs HTML::FormFu::Model::DBIC not to save the value to the database
if it is an empty string. Can you try that and see if it works? Here is a sample
configuration:

  elements:
     - type: Text

       name: some_field
       model_config:
           ignore_if_empty: 1

  Cheers,

  --
  Peter




_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to