| Index
» Projekty
» phpMyEdit
» Fórum
» Table Lookup Default Values |
 |
futurity
Založený: 07.01.2009
Príspevky: 4
Zaslal: 2010-10-15 13:01
Návrat hore
Odpovedať s citátom
|
Hi everyone,
phpMyEdit is great, but there is one problem that I'm constantly hitting time and time again and I was wondering if anyone knows of a solution. I've searched through the forum before making this posting, but I apologise if I've missed the solution else where.
It seems to me that this is a common requirement, so perhaps I've just missed the solution in the documentation?
When using a table lookup for a field, when you create a new record the default value for the field is always the first one in the list, not the default value as defined in the database.
i.e. using the standard table lookup code:
$opts['fdd']['contract_type'] = array(
'name' => 'Contract type',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
$opts['fdd']['contract_type']['values']['table'] = 'contract_types';
$opts['fdd']['contract_type']['values']['column'] = 'id';
$opts['fdd']['contract_type']['values']['description'] = 'name'; // optional
if I set contract_type in the database to a certain default value, it is ignored by phpMyEdit and the first value in the drop down becomes the default.
Does anyone know a way to set the default value for a table lookup or are you always forced to just go with the first one in the list?
Kind Regards
Neil
|
t22harris
Založený: 19.03.2009
Príspevky: 15
Zaslal: 2010-10-15 21:47
Návrat hore
Odpovedať s citátom
|
I read the documentation - page 29 - "Simple Restrictions" to say that the first value is the default.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|