For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > October 2005 > Re: [PEAR] Creating multiple elements of the same fields into an array with FormBuild









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] Creating multiple elements of the same fields into an array with FormBuild
Justin Patrin

2005-10-25, 6:58 pm

On 10/25/05, Dan Rossi <pear@electroteque.org> wrote:
> I dont use formbuilder to post process the data into records , as i
> handle these in a post request method which does other processing.


I suggest if you're using FormBuilder to create the form you also do
processing with it. You can always do other things with the data as
well. Take a look at pre and postProcessFormCallback.

> But
> ill take a look at those possibilities. As for an array elementname,
> quickform wont let you do it no, it craps out.


Actually, yes it will.
require_once('HTML/QuickForm.php');
$form =3D new HTML_QuickForm();
$form->addElement('text', 'arr[]', 'Element 0');
$form->addElement('text', 'arr[]', 'Element 1');
$form->addElement('text', 'arr[]', 'Element 2');
$form->display();

"It craps out" isn't a very good explanation. What *exactly* happens.
QF won't let you, for example, use the same element name for different
element *types*. But it's fine in the above example.

>
> On 25/10/2005, at 2:00 AM, Justin Patrin wrote:
>
>
>



--
Justin Patrin
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com