Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.