PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_QuickForm » Bug #254

exportValue vs. exportValues differences

Details

Submitted2003-11-15 02:34 UTC
Fromcricket at djcricket dot com
StatusWont fix
PackageHTML_QuickForm
PHP Version4.3.3
OSFreeBSD 4.9
Roadmaps(Not assigned)

Comments

[2003-11-15 02:34 UTC] cricket at djcricket dot com

Description:
------------
exportValue and exportValues seem to return different results on a group of checkboxes with integer names. exportValues seems to have problems with the integer names, using them for it's keys in the result, while exportValue uses the correct passed keys.

Reproduce code:
---------------
<?php
require_once 'HTML/QuickForm.php';

$qf =& new HTML_QuickForm ();

$qf->addElement ( 'header' , NULL , 'exportValue() vs. exportValues ()' );

$groupArray = array ();
$groupArray[] =& $qf->createElement ( 'checkbox' , '3' , NULL , 'My name is "3"' );
$groupArray[] =& $qf->createElement ( 'checkbox' , '2' , NULL , 'My name is "2"' );
$groupArray[] =& $qf->createElement ( 'checkbox' , '1' , NULL , 'My name is "1"' );

$qf->addGroup ( $groupArray , 'group' , 'Group' , "<br>\n" );

$qf->addElement ( 'submit' , NULL , 'submit' );

if ( $qf->validate () )
{
echo '<pre>';
echo '<b>exportValues():</b>'."\n";
print_r($qf->exportValues());
echo "\n".'<b>exportValue(\'group\'):</b>'."\n";
print_r($qf->exportValue('group'));
echo '</pre>';
echo '<br><i>Note the different array keys.</i>';
}
else echo $qf->toHTML ();
?>

Expected result:
----------------
The exportValue is the correct value for the group.

Actual result:
--------------
The exportValue is the correct value for the group.