Re: Re: DB_DataObject_FormBuilder set datefield default to null

From: Date: Tue, 18 Sep 2007 19:28:11 +0000
Subject: Re: Re: DB_DataObject_FormBuilder set datefield default to null
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27950@lists.php.net to get a copy of this message
Dear all i've tried to wrote a my custom function: function custom_date2array($date) { $da = array(); if($date==NULL){ $da = array( "d"=>"0","l"=>"0","m"=>"0","Y"=>"0", "H"=>"0","g"=>"0","h"=>"0","i"=>"0", "s"=>"0","a"=>"0","A"=>"0"); print_r($da); return $da; } // other code ... copied from date2array } well, then i've set the call to the custom function: $formBuilder->dateFromDatabaseCallback = 'custom_date2array'; but the output i obtain, is a select having values from 2001 to 2010, and the default date is today. Is it correct to override this function? where should i add the 0 option to the select ? and make it the default selection? thanks > > thanks to your reply. > > I've already read the documentatio, mayme i miss understand something. > > I try to explain you what i'm trying to do: > > - i want that when i create a new record having a field of type > datatime, the default values in the select are set to 0000-00-00 > 00:00:00 instead of the current time. > > - when i edit a record that has the field value set to null or > 0000-00-00 00:00:00 the default values in the selece are still set to > 0000-00-00 00:00:00 instead of the current time > > Ok, what i haven't understand is how can i do that: > > - should i extend the class DB_DataObject_FormBuilder and then ovverride > the method that manages the date ? > > - should i create a new date type ? how can i then set up a method to > manage my new date type? > > - something else ? > > > On 9/18/07, Luca Giandoso <luca.giandoso@gmail.com> wrote: > > About formbuilder settings: > > > > http://pear.reversefold.com/dokuwiki/doku.php?id=pear:db_dataobject_fo > > rmbuilder:configuring_formbuilder > > > > IMHO you should read carefully the docs in: > > > > http://pear.reversefold.com/dokuwiki/doku.php?id=pear:db_dataobject_fo > > rmbuilder:formbuilder_documentation > > > > But if you have already read or if you have not understood I will try > > to help you. > > > > Luca > > > > On 9/18/07, nik600 <nik600@gmail.com> wrote: > > > Many thanks to your reply, > > > > > > but how can i add it? > > > > > > should i specify the name of the field? (if yes, how?) > > > > > > o can i set up a general settings for all datefields ? > > > > > > On 9/18/07, David Sanders <dsanders@baselinesolutions.com.au> wrote: > > > > You'll have to add it to your dataobject, either in > > > > preProcessForm() or > > > > update()/insert() > > > > > > > > nik600 wrote: > > > > > any idea ? > > > > > > > > > > > > > > > On 9/14/07, nik600 <nik600@gmail.com> wrote: > > > > >> Hi to all > > > > >> > > > > >> How can i set for every date field in DB_DataObject_FormBuilder > > > > > >> the default value to null ? > > > > >> > > > > >> > > > > >> Actually it has the actual date and the current time, but i > > > > >> will set it to null. > > > > >> > > > > >> For example: 0000-00-00 00:00:00 > > > > >> > > > > >> Can i do that? > > > > >> > > > > >> how? > > > > >> > > > > >> thanks to all in advance > > > > >> > > > > >> -- > > > > >> /*************/ > > > > >> nik600 > > > > >> rœ•l > > > > >> Ù·µ ѹ; vÿhttps://sourceforge.net/projects/ccmanager > > > > >> > > > > >> https://sourceforge.net/projects/nikstresser > > > > >> > > > > > > > > > > > > > > > > > > > > > > -- > > > > David Sanders > > > > shangxiao > > > > > > > > > > > > > -- > > > /*************/ > > > nik600 > > > https://sourceforge.net/projects/ccmanager > > > https://sourceforge.net/projects/nikstresser > > > > > > -- > > > PEAR General Mailing List (http://pear.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > -- > /*************/ > nik600 > https://sourceforge.net/projects/ccmanager > https://sourceforge.net/projects/nikstresser > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- /*************/ nik600 https://sourceforge.net/projects/ccmanager https://sourceforge.net/projects/nikstresser

« previous php.pear.general (#27950) next »