Re: HTML_QuickForm - setDefaults for 'date' element

From: Date: Thu, 25 Aug 2005 02:21:57 +0000
Subject: Re: HTML_QuickForm - setDefaults for 'date' element
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20584@lists.php.net to get a copy of this message
On 8/24/05, Stefano Tulini - Akensoft <stefano@akensoft.it> wrote: > Hi, I have the following problem. > I have an element of type 'date', constructed as follows. > > $iscr_form -> addElement ( 'date' , 'DataRinnovo' , 'Data di > rinnovo:&nbsp;' , array('format' => 'd . F . Y' , > 'language' => 'it' , > 'minYear' => $data_year , 'maxYear' => $data_year + 1 ), array( > "class" => > "loginform" )); > > It's works fine. The 'year' field has a range between the current year and > the next. > I want to set the fields 'day' and 'month' with the values of current day > and month. These values are stored in 2 variables: $data_day and > $data_month. > I tried using the setDefaults method in various way, but without success.. > What's the right sintax for setDefaults method in association with 'date' > element? > The date element is a group of select elements and is treated like an array. You need to set each of the parts in your format. $form->setDefaults(array('DataRinnovo' => array('d' => '4', 'F' => '5', 'Y' => '1991'))); -- Justin Patrin

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