maxhugen
Posts: 272
|
| Posted: 11/08/2008, 8:25 PM |
|
I'm trying to call 2 functions when rows in an Editable Grid are updated. One function updates a timestamp, and the other trims all text fields.
function UpdateModified() {
global $EditList;
if ($EditList->entity_id->GetValue()) {
$EditList->modified->SetValue(strtotime(date("Y/m/d H:i:s")));
}
}
function CheckData() {
global $EditList;
$EditList->entity_name->SetValue(trim($EditList->entity_name->GetValue()));
$EditList->entity_desc->SetValue(trim($EditList->entity_desc->GetValue()));
}
I've used the same functions in a record webpage AOK, but in the Editable Grid, I've tried the OnValidateRow, BeforeBuildUpdate and BeforeExecuteUpdate events, but the value doesn't get 'saved'.
I use FireBug + FirePhP to check values, and it seems the controls are being set (and trimmed), but the changes are never saved!
Can anyone suggest what might be wrong?
MTIA
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com |
 |
 |
maxhugen
Posts: 272
|
| Posted: 11/09/2008, 7:39 PM |
|
Another problem seems to be that the OnValidateRow, BeforeBuildUpdate and BeforeExecuteUpdate events all fire for every row.
Is there a built-in method to determine if each row was or wasn't edited?
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com |
 |
 |
datadoit
|
| Posted: 11/10/2008, 5:46 AM |
|
Max this is normal expected behavior for an editable grid. See this
post for a clear explanation on how CCS deals with editable grid rows
and values: http://forums.codecharge.com/posts.php?post_id=60507
|
|
|
 |
maxhugen
Posts: 272
|
| Posted: 11/10/2008, 1:58 PM |
|
Thanks for the link datadoit, but it didn't help.
1. I can access the controls OK in PHP. In testing, I've output the original field contents (using FirePHP or echo ), then output it again after running the functions, and it appears to be updated, but my changes don't get saved. (???)
2. Since each event occurs for each row, I can't tell which rows have been updated. Although it doesn't matter if the 'trim' function CheckData runs for each row, I obviously don't want to update a 'modified' timestamp for every row.
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com |
 |
 |
|