| Index
» Projects
» phpMyEdit
» Bug list
» Bug #446 |
 |
|
Viewing Bug Advanced Details |
[ Jump to Bugnotes ]
[ Bug History ]
[ Print ]
|
|
ID |
Category |
Severity |
Reproducibility |
Date Submitted |
Last Update |
|
0000446 |
core / field option |
feature |
always |
2007-07-04 23:30 |
2007-09-08 13:45 |
|
|
|
Reporter |
nepto |
View Status |
public |
|
|
Assigned To |
nepto |
|
Priority |
normal |
Resolution |
reopened |
Platform |
|
|
Status |
feedback |
Duplicate ID |
|
OS |
|
|
Projection |
none |
|
Version |
|
|
ETA |
none |
|
Product Version |
current from CVS |
|
|
Product Build |
|
|
|
Votes |
1 |
|
|
|
Summary |
default value in pull-down not working |
|
Description |
at least when there is lookup to another table...
fetched value is string, that's ok, but fetched key is integer...
So this re-typing is causing problems:
if ((! $found || $multiple) && in_array((string) $key, $selected, 1)
|| (count($selected) == 0 && ! $found && ! $multiple)) {
$ret .= ' selected="selected"';
$found = true;
}
Note that "(string)" in code above.
|
|
Steps To Reproduce |
$opts['fdd']['location_id'] = array(
'name' => 'Location',
'sort' => true,
'values2' => array('' => '- select location -'),
'values' => array(
'table' => 'gastro_locations',
'column' => 'location_id',
'description' => 'name'),
);
if ($_REQUEST['location_id'] > 0) {
$opts['fdd']['location_id']['options'] = 'ACPVDLFR';
$opts['fdd']['location_id']['default'] = $_REQUEST['location_id'];
}
|
|
Additional Information / Solution |
|
|
Attached Files |
|
|
|
|
Bug Notes |
nepto
2007-07-04 23:43
|
Fixed in CVS. |
|
|
michal
2007-09-08 13:45
|
not fixed,
current cvs version php5 mysql50 both integers,
in add mode:
if 'default'=>'2' works
if 'default'=>2 does not work
fix code:
if (! is_array($selected)) {
$selected = $selected === null ? array() : array((string)$selected);
} else {
foreach($selected as $val) $selecte2[]=(string)$val;
$selected = $selected2;
}
and of course
if ((! $found || $multiple) && in_array((string)$key, $selected, 1) |
|
|
|
|