Welcome to the nuBuilder Forums!

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

nuIsSaved and Subform

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Locked
Janusz
nuBuilder Team
Posts: 508
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 10 times
Been thanked: 18 times

nuIsSaved and Subform

Unread post by Janusz »

Hi,
When I add a raw to the suborm then the Save button on the main form is chaging to red but nuIsSaved() function shows "true".
When I modify the main form then nuIsSaved() works OK.

As quick fix I can probably use the button class to check the status:
as after adding new raw it changes the class

Code: Select all

from
class="nuActionButton"
to
class="nuActionButton nuSaveButtonEdited"
how to make a check in JS if nuSaveButtonEdited is present or not in the class.
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: nuIsSaved and Subform

Unread post by kev1n »

Janusz wrote:Hi,
When I add a raw to the suborm then the Save button on the main form is chaging to red but nuIsSaved() function shows "true".
How is the row added? Manually or by script?
Janusz wrote:how to make a check in JS if nuSaveButtonEdited is present or not in the class.
This function will return true, if the button is red, otherwise false.

Code: Select all

function saveButtonEdited() {
    return $('#nuSaveButton.nuSaveButtonEdited').length > 0;
}
Janusz
nuBuilder Team
Posts: 508
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 10 times
Been thanked: 18 times

Re: nuIsSaved and Subform

Unread post by Janusz »

Hi,
Thanks for reply it works OK.
Another possibility which I used in the menatime is to check the color

Code: Select all

function nuIsSaved2() {
var x1=$('#nuSaveButton').css("background-color");
if (x1=="rgb(255, 0, 0)") {return 0;}
return 1;
}
Regarding the subform - it's quite specyfic - with lookup and display fields and no edit fields.
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: nuIsSaved and Subform

Unread post by kev1n »

nuFORM.edited seems to work more reliable:

Code: Select all

if (nuFORM.edited) {
    alert('button should be red');
} else
    alert('button should be blue'); 
}
@Steven: There's probably a window.nuSAVED = false; missing in nuHasBeenEdited()

Code: Select all

function nuHasBeenEdited(){
	
	$('#nuSaveButton').addClass('nuSaveButtonEdited');
	nuFORM.edited	= true;
	window.nuSAVED	= false; // missing?
}

function nuHasNotBeenEdited(){
	
	$('#nuSaveButton').removeClass('nuSaveButtonEdited');
	nuFORM.edited	= false;
	window.nuSAVED	= true;
	
}
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: nuIsSaved and Subform

Unread post by kev1n »

admin
Site Admin
Posts: 2822
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: nuIsSaved and Subform

Unread post by admin »

Janusz and kev1n,

That is now fixed in the latest release.


Steve
Janusz
nuBuilder Team
Posts: 508
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 10 times
Been thanked: 18 times

Re: nuIsSaved and Subform

Unread post by Janusz »

Thanks Steve,
and to confirm nuIsSaved works OK with latest release.
If you like nuBuilder, please leave a review on SourceForge
admin
Site Admin
Posts: 2822
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: nuIsSaved and Subform

Unread post by admin »

Thanks.
Locked