Page 1 of 1

[SOLVED] Default value to NULL

PostPosted: Wed Sep 23, 2009 6:02 pm
by cbrunet
Hi,

I have a field in my database I want to be set to NULL on a new data. I also don't want to display this field in the edit form. This field is of type INTEGER(1).

I tried to put ignore = 1 into fields.ini file, but it doesn't seem to work. If I use widget:type = hidden, it doesn't work because the value is then set to 0 instead of NULL.

How can I do what I want?

Charles

PostPosted: Thu Sep 24, 2009 1:51 am
by Jean
Charles,

you can use

Code: Select all
widget:type = hidden


And you add a function in the Delegate class of your table

Code: Select all
function field__pushValue($record, $element){
            $value = $element->getValue();
             if (!$value) {
             
        return NULL;
        } 
        }


Jean

PostPosted: Thu Sep 24, 2009 10:52 am
by shannah
A couple of other options.

1. Replace your Dataface/Serializer.php with the one found at http://weblite.ca/svn/dataface/core/tru ... alizer.php

or


2. Upgrade to Xataface 1.2 just released yesterday.