Re: Pear QuickForm date element causing problems
| From: | Justin Patrin | Date: | Wed, 11 Aug 2004 21:54:13 +0000 |
| Subject: | Re: Pear QuickForm date element causing problems | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14072@lists.php.net to get a copy of this message | ||
On Wed, 11 Aug 2004 23:37:59 +0200, Sam Miller <collect@gmx.ch> wrote:
> [snip]
> >
> >
> > It could also be 3) a local copy of QuickForm is being used. Are you
> > sure there's no HTML/QuickForm.php in your current dir or in your
> > include_path? Have I asked this before?
> >
> > You can set the defaults with setDefaults() as I have said before.
> >
> > Did you have your provider update HTML_Common as well? It could also
> > be the culprit possibly.
> >
> > What does the HTML source for one of the select boxes look like? Could
> > you post it?
> >
>
> Here's the HTML source for one of the date select boxes. Looks normal,
> except that the empty value is at the very end.
>
> <select name="mydate[d]">
> <option value="1">01</option>
> <option value="2">02</option>
> <option value="3">03</option>
> <option value="4">04</option>
> <option value="5">05</option>
>
> <option value="6">06</option>
> <option value="7">07</option>
> <option value="8">08</option>
> <option value="9">09</option>
> <option value="10">10</option>
> <option value="11">11</option>
>
> <option value="12">12</option>
> <option value="13">13</option>
> <option value="14">14</option>
> <option value="15">15</option>
> <option value="16">16</option>
> <option value="17">17</option>
>
> <option value="18">18</option>
> <option value="19">19</option>
> <option value="20">20</option>
> <option value="21">21</option>
> <option value="22">22</option>
> <option value="23">23</option>
>
> <option value="24">24</option>
> <option value="25">25</option>
> <option value="26">26</option>
> <option value="27">27</option>
> <option value="28">28</option>
> <option value="29">29</option>
>
> <option value="30">30</option>
> <option value="31">31</option>
> <option value=""> </option>
> </select>
>
> As far as I can see I'm not using a local copy of QuickForm. (I tried it
> with Bertrands example and my includes look just like this)
>
> My provider probably didn't update HTML_Common but I'll look into that.
>
> Let me ask a stupid question: How do I use setDefaults() for a date
> element (since it consists of multiple select boxes). That would
> probably the easiest way to fix the whole thing. Just set the defaults
> manually, using setDefaults().
>
Well, I'm not using it *personally* in any code I've written, but some
code I'm using (FormBuilder) is doing ti for me, so I assume it works.
I think that you just have to set it with the format specified in the
date element. Example:
dateElement with date format: Y-m-d
$form->setDefaults(array('dateElement' => '2004-05-04'));
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--