Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Read-only value not available in oldvals?

phpMyEdit General     Read-only value not available in oldvals?
Post new topic   Reply to topic    
 
LP     Joined: 27 Feb 2006   Posts: 1  
Post Posted: 2006-02-27 23:00
Back to top  Reply with quote     

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     Joined: 28 Mar 2006   Posts: 10  
Post Posted: 2006-03-31 17:50
Back to top  Reply with quote     

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     Joined: 28 Mar 2006   Posts: 10  
Post Posted: 2006-03-31 18:48
Back to top  Reply with quote     

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     Joined: 01 Jun 2007   Posts: 24  
Post Posted: 2007-08-23 13:36
Back to top  Reply with quote     

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)

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy