Page 1 of 1

PostPosted: Wed Feb 21, 2007 11:59 am
by alexst
I have the following field:

`Some_long_field_name` tinyint(1) default NULL,

and the following fileds.ini entry

widget:type = "select"
vocabulary = Score

Dataface doesn't seem to pick up on the NULL default setup trough mysql. tried adding "Default = NULL" - didn't work; adding "NULL = N/A" and "Default = N/A" in valuelist.ini didn't work either. It always defaults to 0 which is a problem for me since I am using this filed in AVERAGE calculations.

PostPosted: Thu Feb 22, 2007 2:07 pm
by shannah
Hi Alex,

Good point on this. I'll look into this for a future release.
In the mean time, you can use afterSave() triggers to correct this. Just have a special value in your valuelist that you want to be null, test for this in afterSave() and update the record accordingly.

-Steve

PostPosted: Thu Feb 22, 2007 5:19 pm
by alexst
Thanks, will try it and post the results.

PostPosted: Thu Oct 08, 2009 4:18 am
by woolf
Is there already a solution? I have the same problem, as I have an foreign key constraint on this field and 0 is not a foreign key. I tried to set the value in the function beforeInsert but NULL is handled as a string.

PostPosted: Thu Oct 08, 2009 7:17 am
by shannah
The fix for this is in subversion. If you have the latest Dataface/Table.php and Dataface/Serializer.php it should fix this problem.

http://weblite.ca/svn/dataface/core/trunk

-Steve