How do I get Data before updating

QuestionsHow do I get Data before updating
John N asked 3 years ago

I am trying the code below.
When I add the line: $datab4=$data; it prevents saving the update-probably a code error in do_onselect?

function do_onselect(id)
{
var rd = jQuery('#list1').jqGrid('getCell', id, 'company'); // where invdate is column name
jQuery("#span_extra").html(rd);
$datab4=$data;
}

then (to log only fields changed):

function update_log($data)
{
global $g,$THISTABLE,$resultbefore,$datab4; foreach($data[params] as $k=>$d)
{
//global $StringID;
//global $user;
//$achgs2=$achgs2."(`action`,`attribute_name`,`new_value`, `updated_by`) VALUES ('Update', '$k','$d', '$user')";
$db4=$data["params"]["$k"];
if ($db4<>$d and $k<>"LastUpdated" and $k<>"seqnum") {
$achgs2=$achgs2."[$k][$db4[$i]] to [$d]"; }
$i++;
}

1 Answers
Abu Ghufran answered 3 years ago

Hello,

I don't fully understand your query.
The code '$datab4=$data;' is php code which cannot be placed in JS code section of do_onselect(id).

Your Answer

4 + 20 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?