| Index
» Projects
» phpMyEdit
» Forum
» Make field read only based on data in field |
 |
scava
Joined: 12 Feb 2010
Posts: 1
Posted: 2010-02-12 23:06
Back to top
Reply with quote
|
Hi Everyone,
I have looked all over the forums for a solution to this but can not seem to find the answer, so here goes...
i want to make a field "read only" based on the data in that field, for example, here is me sample code from one of my fields:
$opts['fdd']['excavation']= array(
'name' => 'Excavation',
'select' => 'D',
'maxlen' => 1,
'values' => array('','Complete','Draw Taken'),
'sort' => true,
The first person would run the script and select "Complete" from the drop down box when the task is complete.
Then the second person would log on and see the "Complete" status and know they can perform their task, once the second person has perform their task, they would select "Draw Taken" from the drop down box and save and exit,
Now when the first person goes in again later to update the schedule i do not want them (the first person) to be able to change the "Draw Taken" status previously set by the second person.
I would like this field, when the values is 'Draw Taken' to be read only from then on as a way of locking it from being changed back to complete.
I have tried using triggers i can't seem to grasp how to set the "input" state to "R" based on the value of the field.
Thanks in advance for any help.
Any Thoughts?
|
paddywwoof
Joined: 25 Feb 2010
Posts: 7
Posted: 2010-02-26 11:37
Back to top
Reply with quote
|
****NB I had duped myself into thinking this works but it doesn't!***
even with
| Code: |
$res = $this->myquery(..
$row = $this->sql_fetch($res).. |
to replace the empty $oldvals, the trigger writes the 'R' in too late!
*************************************************
you could put a trigger in like this
| Code: |
$opts['triggers']['update']['pre'] = "trig.php";
|
and the trig.php include file would be like this
| Code: |
<?php
if ($oldvals['excavation'] == 'Draw Taken' ) {
$this->fdd['excavation']['input'] = 'R';
}
return true;
?>
|
|
|
Post new topic
Reply to topic
|
|
|
|