Re: QuickForm setDefaults problem ?
| From: | Levy | Date: | Sun, 01 Feb 2004 20:45:50 +0000 |
| Subject: | Re: QuickForm setDefaults problem ? | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10476@lists.php.net to get a copy of this message | ||
Bertrand Mansion wrote:
<levy@vogn.is> wrote :Hi, thanks for the reply. It was not HTML_Common, it's up to date. The 'select' box is loading the array I give it and no problems there but I can't select a specific value in the 'select' box. 'setDefaults();' and 'setSelected();' do not work but they work in all other elements e.g. 'text' and 'textarea'. I can't imagine what causes this. Maybe I'm not loading the array properly as an '$option' in the 'addElement();' method ?? I don't know. Please help, it's been days now :/ LevyHi all. require_once "HTML/QuickForm.php"; $form = new HTML_QuickForm('formAddUser', 'post'); $form->setDefaults(array( 'name' => '1' )); //Hvave tried to put 'Paul' also $form->addElement('select', 'name', 'Names:',array('1'=>'Paul','2'=>'Jack')); $form->addElement('reset', 'btnClear', 'Clear'); $form->addElement('submit', 'btnSubmit', 'Submit'); if ($form->validate()) {If the following:// Form is validated, then processes the data $form->freeze(); echo "\n<HR>\n";} $form->display(); ?> ------------------------------------------------------- setSelected(); doesn't work either, have tried that. I don't understand what I'm doing wrong and I think I have tried every possible workarounds (execpt for the right one ofcourse :P) ca someone please reply, I really am desperate :/$form->setDefaults(array('name' => 'Paul')); $form->addElement('select', 'name', 'Names:', array('Paul', 'Jack')); $form->display();does not work, then it might be your version of HTML_Common that is not up to date. Bertrand Mansion Mamasam