Re: Followup Q to HTML_QuickForm With Arrays as Text Elements?
| From: | James 'Chip' Kaufman | Date: | Wed, 05 Nov 2003 18:14:57 +0000 |
| Subject: | Re: Followup Q to HTML_QuickForm With Arrays as Text Elements? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8783@lists.php.net to get a copy of this message | ||
On Wednesday 05 November 2003 11:31, Bertrand Mansion wrote:
> <jkaufman@wamnetgov.com> wrote :
> > If I set up my form like this (recommended by Bertrand Mansion):
>
> > $form->addElement ('text', "reqdate[0]", 'Req. Start',
> > array('size'=>'10'));
> >
> > It looks ok in a QuickForm dump:
> >
> > [11] => html_quickform_text Object
> > (
> > [_attributes] => Array
> > (
> > [size] => 10
> > [name] => reqdate[0]
> > [type] => text
> > [value] => 07/17/2003
> > )
> > [_tabOffset] => 0
> > [_tab] =>
> > [_lineEnd] =>
> > [_comment] =>
> > [_label] => Req. Start
> > [_type] => text
> > [_flagFrozen] =>
> > [_persistantFreeze] => 1
> > )
> >
> > However, I'm using the ArraySmarty renderer, and the smarty dump
> > looks like:
> >
> > [0] => Array **** This is the problem line
> > (
> > [name] => reqdate[0]
> > [value] => 07/17/2003
> > [type] => text
> > [frozen] =>
> > [label] => Req. Start
> > [required] =>
> > [error] =>
> > [html] =>
> > )
> >
> > Notice that the array key changed from 'reqdate[0]' to '[0]'. Is
> > this another array_merge glitch? Some obvious fix?
>
> I don't see any difference between the two ?
>
> Bertrand Mansion
> Mamasam
The difference is that the key in the Smarty object should be
'reqdate[0]'. Instead, it is converted simply to '[0]'. That means that
the smarty template, which is referring to '{$form.reqdate[0]...}'
won't find the data.
--
James 'Chip' Kaufman
jkaufman@wamnetgov.com
952-346-3532
PGP key: 697D43DE