Quickform select freeze problem

From: Date: Thu, 26 May 2005 14:01:20 +0000
Subject: Quickform select freeze problem
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19376@lists.php.net to get a copy of this message
There's a strange behaviout in freezing select elements in QF. I want an empty (zero) value in the top of array I use for select fields, to display a nice label (e.g, "choose one"). I don't put it directly in the array since I need to validate (server-side) choosen option against the array (via a simple registerrule) But... when I freeze the form, I don't get the choosen option! Instead, I get the "choose" option (I understand it sound a bit confusing, it's simpler to try than to explain) Example code: <?php require_once 'HTML/QuickForm.php'; $arr = array('a' => 'this is a', 'b' => 'this b', 'c' => 'this c'); $form =& new HTML_QuickForm('mytest'); $form->addElement('text', 'mytext', 'text'); $form->addElement('select', 'mysel', 'abc', array('choose') + $arr); $form->addElement('submit', 'ok', 'OK'); if ($form->validate()) {
    $form->freeze();
    $form->removeElement('ok');
} echo $form->toHtml(); ?> Tried to look into QF source code, but no success. Am I missing something? TIA -- Massimiliano Arione :: http://www.garak.it/ :: * NO WORD * http://gnu.org/philosophy/no-word-attachments.html * NO HTML * http://efn.no/html-bad.html

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