Page 1 of 1

Detecting when edit form has changed...

Posted: Wed Feb 13, 2013 9:09 pm
by parkerjnc
I would like to know when a record is being saved if it was changed or not. If it was changed, then some code will execute under After Save, otherwise the code can be skipped.

I cannot seem to find it now, but I thought I had seen a variable somewhere that is set on the edit form when any data in the form was changed. Was I dreaming?

Re: Detecting when edit form has changed...

Posted: Thu Feb 14, 2013 1:25 am
by admin
parkerjnc,

beenedited is what you want.

Steven

Re: Detecting when edit form has changed...

Posted: Thu Feb 14, 2013 2:11 pm
by mlgeek
Is there any documentation on using beenedited? I've not been able to find any.

Re: Detecting when edit form has changed...

Posted: Thu Feb 14, 2013 8:56 pm
by parkerjnc
This does not seem to be working for me. In my After Save code I want to send an email if the record was modified. When the check of #beenedited# did not work, I removed the check and added it to the body of the email so I could see the value easily. It is always '0' whether anything was changed or not. Any ideas?

Re: Detecting when edit form has changed...

Posted: Thu Feb 14, 2013 11:21 pm
by admin
mlgeek,

There is no documentation as it was just to be used by nuBuilder its self.

parkerjnc,

You'll need to create a hack by putting some JavaScript on the form you want to check..

Code: Select all


$(document).ready(function () {

   e = document.createElement('input');              //-- create a hidden input
   e.setAttribute('id','has_changed');
   e.setAttribute('name','has_changed');
   $('#theform').append(e);
   $('#' + e.id).css( 'visibility', 'hidden');

   $("select,textarea,input").change(function () {
      $('#has_changed').val(1);
   });
});


Then you can use #has_changed#


Steven

Re: Detecting when edit form has changed...

Posted: Fri Feb 15, 2013 7:25 pm
by parkerjnc
Excellent! Works like a charm. :D

Re: Detecting when edit form has changed...

Posted: Sun Feb 17, 2013 2:09 am
by admin
.