Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
nuHasBeenSaved() Topic is solved
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
nuHasBeenSaved()
Hi,
Two situations where the window.nuTimesSaved counter should not be incremented:
1.
After a Clone Action has taken place, nuHasBeenSaved() should return 0.
(window.nuTimesSaved = 0;)
Edit: As I see, this has been solved, it's on Github.
2.
When a new record is opened and then, if the unsaved record is refreshed (Options Menu -> Refresh or Ctrl + Shift + R) nuHasBeenSaved() is incremented.
Two situations where the window.nuTimesSaved counter should not be incremented:
1.
After a Clone Action has taken place, nuHasBeenSaved() should return 0.
(window.nuTimesSaved = 0;)
Edit: As I see, this has been solved, it's on Github.
2.
When a new record is opened and then, if the unsaved record is refreshed (Options Menu -> Refresh or Ctrl + Shift + R) nuHasBeenSaved() is incremented.
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: nuHasBeenSaved()
hmmm, nuHasBeenSaved() still returns 1 after a refresh.
1. Open a new or existing record
2. nuHasBeenSaved() returns 0
3. Refresh the record
2. nuHasBeenSaved() returns 1
1. Open a new or existing record
2. nuHasBeenSaved() returns 0
3. Refresh the record
2. nuHasBeenSaved() returns 1
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: nuHasBeenSaved()
toms,
This is it here...
Steven
This is it here...
Steven
You do not have the required permissions to view the files attached to this post.
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: nuHasBeenSaved()
Steven,
It still doesn't work for me.
It works if I change it to this (replace == 0 with >=0)
Tested use cases with correct results:
Action: Open Browse Screen.
[Result]: nuHasBeenSaved() returns -1
Action: Open Browse Screen, then select a record (opens Edit Screen)
[Result]: nuHasBeenSaved() returns 0
Action: Open Browse Screen, then select a record, save the record
Result: nuHasBeenSaved() returns -1
Action: Open Browse Screen, then select a record, save the record twice
Result: nuHasBeenSaved() returns 2
Action: Open Browse Screen, then select a record, save the record three times
Result: nuHasBeenSaved() returns 3
Action: Open Browse Screen, then select a record, save the record three times, return to the Browse screen
Result: nuHasBeenSaved() returns -1
Action: Add a new record, save it
Result: nuHasBeenSaved() returns 1
Action: Open a record, clone it
Result: nuHasBeenSaved() returns 0
Action: Open a record, refresh
Result: nuHasBeenSaved() returns 0
It still doesn't work for me.
It works if I change it to this (replace == 0 with >=0)
Code: Select all
if(window.nuTimesSaved >= 0){
window.nuTimesSaved = -1;
}
Action: Open Browse Screen.
[Result]: nuHasBeenSaved() returns -1
Action: Open Browse Screen, then select a record (opens Edit Screen)
[Result]: nuHasBeenSaved() returns 0
Action: Open Browse Screen, then select a record, save the record
Result: nuHasBeenSaved() returns -1
Action: Open Browse Screen, then select a record, save the record twice
Result: nuHasBeenSaved() returns 2
Action: Open Browse Screen, then select a record, save the record three times
Result: nuHasBeenSaved() returns 3
Action: Open Browse Screen, then select a record, save the record three times, return to the Browse screen
Result: nuHasBeenSaved() returns -1
Action: Add a new record, save it
Result: nuHasBeenSaved() returns 1
Action: Open a record, clone it
Result: nuHasBeenSaved() returns 0
Action: Open a record, refresh
Result: nuHasBeenSaved() returns 0
Last edited by Anonymous on Tue Aug 21, 2018 7:47 am, edited 4 times in total.
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: nuHasBeenSaved()
This case has yet to be dealt with:
If nuReturnNewRecord() is called in PHP (AS event)
nuHasBeenSaved() returns 1 instead of 0.
This is in contradiction with nuIsNewRecord() that correctly returns true
If nuReturnNewRecord() is called in PHP (AS event)
nuHasBeenSaved() returns 1 instead of 0.
This is in contradiction with nuIsNewRecord() that correctly returns true
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: nuHasBeenSaved()
Steven,
It still doesn't work. (and I don't see any changes in the latest commit )
It still doesn't work. (and I don't see any changes in the latest commit )
But my suggested fix works for me (Aug 17, 2018)toms wrote:hmmm, nuHasBeenSaved() still returns 1 after a refresh.
1. Open a new or existing record
2. nuHasBeenSaved() returns 0
3. Refresh the record
2. nuHasBeenSaved() returns 1
toms wrote: It works if I change it to this (replace == 0 with >=0)
Code: Select all
if(window.nuTimesSaved >= 0){ window.nuTimesSaved = -1; }