preGenerateForm questions [FormBuilder]

From: Date: Wed, 23 Jun 2004 19:00:17 +0000
Subject: preGenerateForm questions [FormBuilder]
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13281@lists.php.net to get a copy of this message
Hi, Can someone post an example of preGenerateForm() in action? I've been getting errors when using it (it's in the DO). Think I've got the syntax wrong. function preGenerateForm(&$form){ $form->updateElementAttr('first_name', 'onchange="hello();"'); } [I tried it in a bunch of other configurations, passing $do and $fg and nothing -- but no luck. So I'm missing something]. erro: Call to undefined function: updateelementattr() Anyway, I'd like to use preGenerateForms for a few things (that I can do for the most part when *not* using it). 1. Attach special javascript events to specific elements (example above). Works fine outside function as such: $form->updateElementAttr('first_name', 'onchange="hello();"'); 2. Create element groups so that I can apply styles later on. This I can do fine outside of preGenerateForm -- but my group is created IN ADDITION to the elements in the form and appended to the end of the form. How would I create that so that it renders in the right order in the render -- ie, replaces the original elements not duplicates them at the end? This is my "working" but appending-not-replacing code: $name[] = $form->getElement(first_name); $name[] = $form->getElement(last_name); $form->addGroup($name, 'nameGrp', 'Name Please'); 3. Also -- if I wanted to pass along a piece of info with each element that I could use when rendering, how would I do it? Specifically I'd like to be able to have an element know if it was going to be colspan 1, 2, etc. (And not have it dependent on the element.type). Thoughts on passing xtra info with the elements that I can parse in the renderer? Or should I just do this using style groups? Thanks in advance, s.

« previous php.pear.general (#13281) next »