Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.10

Bug #5625 Fall to defaults using multiple choice selects
Submitted: 2005-10-07 15:39 UTC Modified: 2005-11-03 15:37 UTC
From: anibal dot pacheco at dinama dot gub dot uy Assigned:
Status: Duplicate Package: HTML_QuickForm_Controller
PHP Version: 4.4.0 OS: Debian GNU/Linux
Roadmaps: (Not assigned)    
Subscription  


 [2005-10-07 15:39 UTC] anibal dot pacheco at dinama dot gub dot uy
Description: ------------ When you use a 'select' element with multiple choice and a default value, this default value is setted when you select nothing and browse the pages of the form and come back. I think common sense tells us that when we come back to the page that has the select list nothing must be selected for us. Test script: --------------- <?php require_once 'HTML/QuickForm/Controller.php'; session_start(); class Page1 extends HTML_QuickForm_Page{ function buildForm(){ $this->_formBuilt = true; $this->addElement('text','tstText','Does not matter'); $this->addElement('submit',$this->getButtonName('next'), 'next >>'); } } class Page2 extends HTML_QuickForm_Page{ function buildForm(){ $this->_formBuilt = true; $sel =& HTML_QuickForm::createElement('select','tstSel','Please select:',array('One','Two','Three')); $sel->setMultiple(true); $sel->setSize(3); $this->addElement($sel); $this->addElement('submit',$this->getButtonName('back'), '<< Back'); $this->addElement('submit',$this->getButtonName('next'), 'Finish'); $this->setDefaults(array('tstSel'=>array(0))); } } $cont =& new HTML_QuickForm_Controller('myForm'); $cont->addPage(new Page1('pageone')); $cont->addPage(new Page2('pagetwo')); $cont->run(); ?> Expected result: ---------------- If I de-select the default value in the first time page two appear "blanking" the selections, I expect that when I come back to this page nothing is selected. Actual result: -------------- When I come back, the default value is selected.

Comments

 [2005-11-03 15:37 UTC] avb
This is the same problem that was described in bug #5615. Fixed in CVS.