| Index
» Projekty
» phpMyEdit
» Fórum
» Read-only value not available in oldvals? |
 |
LP
Založený: 27.02.2006
Príspevky: 1
Zaslal: 2006-02-27 23:00
Návrat hore
Odpovedať s citátom
|
Is it a bug or a feature?
I found out that a field marked as read-only for "change" ('input' => 'R|C') will not be available in oldvals and newvals arrays.
I find this annoying, since I am performing actions based on the value of this field in a trigger.
I also don't understand the rationale of not having this value available, even though it's read only.
Hiding the field is ok, the value is then available, but I would prefer having the field read-only, providing the user with some feedback on what the value is.
Maybe there is a reason for this?
|
DeanS
Založený: 28.03.2006
Príspevky: 10
Zaslal: 2006-03-31 17:50
Návrat hore
Odpovedať s citátom
|
I have the same problem as above. I am using a trigger to check a value but first need to check the value of the read-only field.
Is there anywhere this value is held and can be got at?
Regards
Dean
|
DeanS
Založený: 28.03.2006
Príspevky: 10
Zaslal: 2006-03-31 18:48
Návrat hore
Odpovedať s citátom
|
I HAVE GOT A WORKAROUND.
1.
Do not use 'input' => 'R' (Let it stay editable)
2.
In the trigger file add the following line at the top of the trigger
//Reset New value to Old value
if($newvals['column'] != $oldvals['column']) $newvals['column'] = $oldvals[column];
But still would be nice to be able to get the value of a read-only field in a trigger.
Regards
Dean
|
KarelB
Založený: 01.06.2007
Príspevky: 24
Zaslal: 2007-08-23 13:36
Návrat hore
Odpovedať s citátom
|
Another trick i like to share:
Create a dummy column along the lines of:
$opts['fdd']['col1'] = array(
'name' => 'col1',
'options' => 'LFCR',
'nowrap' => true,
'sort' => true
);
$opts['fdd']['dummy_col1'] = array(
'name' => 'dummy',
'options' => 'HC',
'sql' => 'col1',
'nowrap' => true,
'sort' => true
);
You can now use the value of newvals['dummy_col1'] which is a copy of the original value of col1.
(make sure that your db table has a dummy_col1 field as well)
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|