|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-08-22 07:00 UTC] avb@php.net
[2003-09-07 09:50 UTC] mansion@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 06:00:01 2025 UTC |
Description: ------------ HTML_QuickForm, hierselect element If a setDefaults is applied before the addElement line, only the Main hierselect box is set to the default. If applied after the addElement line it works correctly. The example code shows the bug; if the existing setDefaults line is commented out, and commented-out one uncommented, it works fine. Reproduce code: --------------- $main[0] = "England"; $main[1] = "Scotland"; $main[2] = "USA"; $secondary[0][0] = "London"; $secondary[0][1] = "Manchester"; $secondary[0][2] = "Liverpool"; $secondary[1][3] = "Edinburgh"; $secondary[1][4] = "Glasgow"; $secondary[2][5] = "Fort Worth"; $secondary[2][6] = "Boston"; $secondary[2][7] = "Los Angles"; $form->setDefaults(array('location'=>array(1,4))); $sel =& $form->addElement('hierselect', 'location', 'Location:'); $sel->setMainOptions($main); $sel->setSecOptions($secondary); $form->addElement('submit', 'btnSubmit', 'Submit'); #$form->setDefaults(array('location'=>array(1,4))); $form->display(); Expected result: ---------------- Main box showing 'Scotland', secondary box showing 'Glasgow'. Actual result: -------------- Only the main hierselect box default is set, so the display is "Scotland" "London".