Page 1 of 1

Detecting when edit form has changed...

PostPosted: Thu Feb 14, 2013 5:39 am
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...

PostPosted: Thu Feb 14, 2013 9:55 am
by admin
parkerjnc,

beenedited is what you want.

Steven

Re: Detecting when edit form has changed...

PostPosted: Thu Feb 14, 2013 10:41 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...

PostPosted: Fri Feb 15, 2013 5:26 am
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...

PostPosted: Fri Feb 15, 2013 7:51 am
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...

PostPosted: Sat Feb 16, 2013 3:55 am
by parkerjnc
Excellent! Works like a charm. :D

Re: Detecting when edit form has changed...

PostPosted: Sun Feb 17, 2013 10:39 am
by admin
.