Date index for Aug 2002


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [achievo] edit_values()



Hi,

Jonas Lincoln wrote:

I've understood from the code that it's possible to set default values in a editForm with edit_values().

Almost right. If you want to set default values, use initial_values. All new records get the value you set here.


edit_values is for editing existing records. Suppose you want to set some statusfield to 'edited', when editing a record, you can do that in the edit_values function.

Both functions have the same syntax:

funtion initial_values()
{
  return array("attribname"=>"attribvalue");

  // Example:
  // return array("status"=>"new",
  //              "date"=>"2002-07-15");
}

Or is there a smarter way of adding default values to, as in my case, an atkDateAttribute? In the timereg-addpage, I'd like it to "remember" the last date I added in the database, so I won't have to select it again if I want to insert more hours the same day.

the current dateI'm not sure initial_values will work there, but you can try. The reason I'm not sure is that, in class.hours.inc, there is already some logic implemented to remember if you went to a specific day from the weekview. That might override the initial_values setting.


Greetings,
Ivo

--
Ivo Jansch <ivo dot 
ibuildings.nl BV - information technology
http://www.ibuildings.nl



http://www.achievo.org/lists achievo.org - ©1999-2002 ibuildings.nl BV