On 13.12.2007 14:03 John Siracusa wrote:

> On Dec 13, 2007 4:24 AM, Michael Lackhoff <[EMAIL PROTECTED]> wrote:
>> When I create a record with such a field, it is usually NULL but
>> after some editing with the help of RHTMLO the empty field value could
>> become '' when saved.
> 
> I believe the latest release of Rose::HTML::Objects fixed this bug for
> Numeric fields.  That is, you should get undef for an empty Numeric
> field instead of an empty string.  Does this bug exist in other field
> types as well?

I didn't install the latest version yet but this is what I get with a
text field:
1. set a field 'anrede2' to NULL with the sqlite3 command line
2. edit the record with RHTMLO without touching 'anrede2'
   Here is the form/field definition:
   anrede2 => {type => 'text', class => 'normfield'},
   linked to RDBO with init_with_object/object_from_form
3. After $obj->save I check again at the command line and it is ''

But I wouldn't count this as a bug. After all there is no way for a
query parameter to keep the difference between undef/NULL and ''.
Both would look like http://myserver/myapp?anrede2=&otherparam=xyz and
it is always arbitrary if RHTMLO makes it '' or undef.
That's why I suggested a RDBO column attribute.
Ron's suggestion to make it NOT NULL would also solve the problem but
then I would have to prepopulate every optional field with '' -- a value
that is not really meant to be a value but is meant to be empty/undef/NULL.
I like it when the schema reflects my intention, so that NOT NULL really
means "Don't leave this empty", this is why I don't like to use it for
fields that are meant to be optional.
But thanks for the reading suggestion, will try to read it, perhaps I
get convinced.

-Michael

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to