reorder the elements of a quickform
| From: | mike | Date: | Wed, 06 Oct 2004 12:35:05 +0000 |
| Subject: | reorder the elements of a quickform | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14772@lists.php.net to get a copy of this message | ||
Hi!
I would like reorder the elements of my quickform, here's my code : I have
my database elements and I add some elements with addElement function, I
would like that these elements are placed before.
I used the patch for reorder the elements but he seems not to function !
Some elements are duplicated after use the moveElementAfter function three
times. Why this functionnality does not exist in HTML_QUICK_FORM? it's very
important. I use the version 2.0 of HTML_QUICK_FORM (cvs version)
function preGenerateForm(){
$el['objet'] = &HTML_QuickForm::createElement('textarea',
'objet',"Objet");
......
$this->fb_preDefElements = &$el;
}
function postGenerateForm(&$form)
{
$this->removeElement(&$form);
$this->urlList="g2i/apindex&id=".$this->aapc_code;
if(isset($_GET['id'])){
$this->urlList="g2i/apindex&id=".$_GET['id'];
}
$group1[] =
&HTML_QuickForm::createElement("text","opclassprincipale","");
$group1[] =
&HTML_QuickForm::createElement("text","opclasssupplementaire1","",
array('size' => 10));
$group1[] =
&HTML_QuickForm::createElement("text","opclasssupplementaire2","",
array('size' => 10));
$group1[] =
&HTML_QuickForm::createElement("text","opclasssupplementaire3","",
array('size' => 10));
$form->addGroup($group1,"bloc1", 'Objet principal', '');
}
$form->moveElementAfter('label1','objet');
$form->moveElementAfter('label2','conceptionrealisation');
}