Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

How to tell if the form has been edited in Javascript

Questions related to using nuBuilder Forte.
Post Reply
alf1976
Posts: 75
Joined: Tue Dec 26, 2017 8:58 pm

How to tell if the form has been edited in Javascript

Unread post by alf1976 »

Hi

What the is easiest way to tell if a form has been edited via Javascript?

i use nuAddActionButton to add the ability to run a report from an 'edit form' but i only want the report to run if the data is 'saved'. So basically when the save button is not red.

nuHasBeenEdited(). nuHasNotBeenEdited() only alters the status. i tried using nuIsSaved() in the Action Button function but that just kept returning false and i couldn't see anything in nuCurrentProperties. Any ideas?

Andrew
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: How to tell if the form has been edited in Javascript

Unread post by toms »

alf1976 wrote: i tried using nuIsSaved() in the Action Button function but that just kept returning false
Hi,

nuIsSaved() doesn't seem to work for me either (always returns false).

Maybe a workaround: Check if the save button is not red:

Code: Select all

if (!$('#nuSaveButton.nuSaveButtonEdited').length) {
  // run report
}
Last edited by Anonymous on Sat Jul 21, 2018 7:41 pm, edited 1 time in total.
alf1976
Posts: 75
Joined: Tue Dec 26, 2017 8:58 pm

Re: How to tell if the form has been edited in Javascript

Unread post by alf1976 »

Hi Toms,

thanks, that is a useful workaround.

i can get nuIsSaved() to return true, but only when it placed in the code section that runs when the form opens . ie

Code: Select all

if(nuFormType() == 'edit')
{
    if(nuIsSaved()===true)
    {
      // do something...
    }
    if (nuIsNewRecord()===true)
    {
        // do something 
    }
}
The wiki does say 'Used to tell if the current Edit Form has just been Saved'. So i suppose it does do what it says.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: How to tell if the form has been edited in Javascript

Unread post by admin »

alf1976,

I believed I have fixed it now.

Let me know if nuIsSaved() works for you now.

Steven
Post Reply