RE: [PEAR] Heterogeneous element types in AddGroup?
| From: | Andy Kalinowitsch | Date: | Thu, 12 Jun 2003 13:48:35 +0000 |
| Subject: | RE: [PEAR] Heterogeneous element types in AddGroup? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5915@lists.php.net to get a copy of this message | ||
Hi Alexey,
We are using QuickForm 3.0. I'm constructing the elements with
$cust_fields[] = &HTML_QuickForm::createElement('checkbox',
"field$curr_field", "$rowfield_intro_text]");
$curr_field++;
and
$cust_fields[] = &HTML_QuickForm::createElement('textarea',
"field$curr_field", "$rowfield_intro_text]");
$curr_field++;
etc., and then adding it to a group with
$form->addGroup($cust_fields, 'custom_fields', 'Custom Fields','<br
/>'); .
When I inspect the custom_fields object (in code, or with print_r), its
[fields] array only has one element (the last one processed):
[custom_fields] => Array
(
[name] => custom_fields
[value] =>
[type] => group
[frozen] =>
[label] => Custom Fields
[required] =>
[error] =>
[separator] => <br />
[html] => <input name="custom_fields[field0]" type="checkbox"
value="1" id="qf_90c1b2" /><label
for="qf_90c1b2"></label><br /><input
name="custom_fields[field1]" type="checkbox" value="1"
id="qf_51c358"
/><label for="qf_51c358"></label><br /><textarea
name="custom_fields[field2]"></textarea>
[fields] => Array
(
[name] => custom_fields[field2]
[value] =>
[type] => textarea
[frozen] =>
[label] => We'd love to hear from you.
Suggestions, feedback and ideas are all welcome.
[required] =>
[error] =>
[html] => <textarea
name="custom_fields[field2]"></textarea>
)
Alexey Borzov wrote:
Hi!
Andy Kalinowitsch wrote:
> Sorry -- I would like the resulting custom_fields.fields array to contain
> *all* of the elements I passed in through the $cust_fields array param.
> Right now, custom_fields.fields seems to only contain the last element
> processed ("field2").
>
> I would like to iterate over the custom_fields.fields array and access the
> .label and .html properties for each element individually (instead of only
> being able to display the grouped HTML) ...
Oh, I see, I didn't understand that only the data for one element was
returned.
Upon closer inspection: The array output certainly looks weird, it is not
produced by either Array or ArraySmarty renderer. It doesn't even look like
old
toArray() result. What version of QuickForm are you using and what method
produces such output?
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php