Re: HTML_QuickForm - setDefaults for 'date' element
| From: | Stefano Tulini - Akensoft | Date: | Thu, 25 Aug 2005 02:51:30 +0000 |
| Subject: | Re: HTML_QuickForm - setDefaults for 'date' element | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20585@lists.php.net to get a copy of this message | ||
Thank you, Justin.
Your solution works very well!
Stefano
At 04.21 25/08/2005, you wrote:
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: ' , 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-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.14/79 - Release Date: 22/08/2005