QF Getting all checkbox elements in a Form.
| From: | Popbox | Date: | Thu, 03 Feb 2005 22:56:49 +0000 |
| Subject: | QF Getting all checkbox elements in a Form. | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17369@lists.php.net to get a copy of this message | ||
Hi,
I am wondering, if there is a posebillity of getting all Element names of a
defines form into an array.
I want (so that i can work propperbly with JavaScript) all elements have
fitted with an id of there name.
For this i also have written a little fonction like you see on the bottom of
this text.
I now just need an array of all the element names inside my form.
Due to I have a lot forms I i don't want to write a line of text for every
element.
Like here.
$attribs = array('id'=>'tel', 'class'=>'form');
$form->addElement('text','tel','Telefon',$attribs);
That would be pain in the ass.
function set_form_id($namearr)
{
global $form;
foreach($namearr as $tmp)
{
$el =& $form->getElement($name);
$el->updateAttributes(array('id' => $tmp));
}
}
Thanks for your help.
Mirco Blitz