| Support Center

(Back to Website)

Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

How do I get Data before updating

John N Oct 01, 2017 09:33AM PKT

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++;
}

Up 0 rated Down
Abu Ghufran Oct 02, 2017 12:25AM PKT PHP Grid - Support Center Engineer
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).

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Contact Us

  • Post a Public Question
  • Email Us
  • Live Chat!
  • Ask the Community

    Instructions

    • Paste complete code that is involved in your question. You can use pastebin.com to share code link.

    Screenshots or Online link of webpage is helpful in resolution. You can also send email at address mentioned below.

    • To report an issue, Write steps to regenerate the case.

    • For email support or live chat, Use gridphp@gmail.com and add it in Google Chat.
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete