[SOLVED] Default value to NULL

A place for users and developers of the Xataface to discuss and receive support.

[SOLVED] Default value to NULL

Postby 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
Last edited by cbrunet on Mon Oct 12, 2009 11:58 am, edited 1 time in total.
--
Charles Brunet
http://cbrunet.net
cbrunet
 
Posts: 13
Joined: Tue Aug 19, 2008 7:14 am
Location: Québec, Canada

Postby 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
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby shannah » Thu Sep 24, 2009 10:52 am

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.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 29 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved