QuickForm: How do I setup the Date element values?

From: Date: Mon, 14 Mar 2005 15:05:45 +0000
Subject: QuickForm: How do I setup the Date element values?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-18022@lists.php.net to get a copy of this message
I have the following date element: $form->addElement('date', 'orderdate', 'Order Date:', array('format'=>'Y-m-d', 'minYear'=>2010, 'maxYear'=>2001)); I know that this creates an array, orderdate[Y,m,d], it defaults to 2010-1-1, how do I pass an array back to the date element to set the values to something else (e.g. if I'm using the form to edit pre-existing data) I tried the following: // separate date in format 2004-01-01 $explodeDate = explode ( "-", $objData->orderdate ); // construct new array $existDate = array("Y"=> $explodeDate[0], "m" => $explodeDate[1], "d" => $explodeDay[2]); // try and change the value of the date element $form->addElement('date', 'orderdate', 'Order Date:', array('format'=>'Y-m-d', 'minYear'=>2010, 'maxYear'=>2001, 'value' => $existDate)); But that didn't work. Thanks, Mark

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