[SOLVED] Default value to NULL
Archived from the Xataface Users forum.
cbrunet — Wed Sep 23, 2009 6:02 pm
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
Jean — Thu Sep 24, 2009 1:51 am
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
shannah — Thu Sep 24, 2009 10:52 am
A couple of other options.
- Replace your Dataface/Serializer.php with the one found at http://weblite.ca/svn/dataface/core/tru … alizer.php
or
- Upgrade to Xataface 1.2 just released yesterday.