Welcome to the nuBuilder Forums!

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

Close or Abort Form after Clone

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
icoso
Posts: 181
Joined: Sun Feb 07, 2021 11:09 pm
Been thanked: 1 time

Close or Abort Form after Clone

Unread post by icoso »

Is there a function or button function or any function that once I execute a Clone Function of the existing form record, that I can abort this clone or close it WITHOUT saving? I have searched for hours to try to find something in these forums and cant find anything examples how to exit out of a form and NOT save it. I don't want to just click on the nuBuilder Form item at the top. I am wanting a button on the form once I click Clone that will "Exit without saving." the current form Im editing. This to prevent my users from saving a cloned rather than edited form by mistake.

I already have the button on the heading to "Exit-No Save", and have already got the if nuIsClone() { alert(); } working. I just need to know the actual method, function, code to exit the form without saving instead of the alert(). Preferably, I'd like it to go back to the Search/browse screen and reset the search.

Besides the Javascript and PHP functions in the wiki, and the code repository (Ive looked for examples there too), is there anything else that would be helpful in finding this type of info out?
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Close or Abort Form after Clone

Unread post by kev1n »

icoso wrote:Is there a function or button function or any function that once I execute a Clone Function of the existing form record, that I can abort this clone or close it WITHOUT saving?

Code: Select all

nuHasNotBeenEdited();
nuOpenPreviousBreadcrumb();
icoso
Posts: 181
Joined: Sun Feb 07, 2021 11:09 pm
Been thanked: 1 time

Re: Close or Abort Form after Clone

Unread post by icoso »

That worked exactly as I wanted. It closed the screen and exited to the previous search screen. Thanks!
getNo
Posts: 21
Joined: Thu Feb 18, 2021 5:56 pm

Re: Close or Abort Form after Clone

Unread post by getNo »

kev1n wrote:
icoso wrote:Is there a function or button function or any function that once I execute a Clone Function of the existing form record, that I can abort this clone or close it WITHOUT saving?

Code: Select all

nuHasNotBeenEdited();
nuOpenPreviousBreadcrumb();
I did not found this function in the wiki. Is there a way to go multiple crumbs backwards?
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Close or Abort Form after Clone

Unread post by kev1n »

nuOpenPreviousBreadcrumb() is new in Version 4.5 and it's not yet documented in the Wiki.

To go back multiple Breadcrumbs, use this function:

E.g. this would go back 2 Breadcrumbs.

Code: Select all

nuOpenPreviousBreadcrumb(2)

Code: Select all

function nuOpenPreviousBreadcrumb(b) {

	// If a popup is open, close it
	if (parent.$('#nuModal').length > 0) {
		nuClosePopup();
		return;
	}

	if (b === undefined) {
		var b = -2; 
	} else {
		b = b + 1;
	}
 
	var l = window.nuFORM.breadcrumbs.length;
	if (l > 1) {
		nuGetBreadcrumb(l - b);
	}
}
getNo
Posts: 21
Joined: Thu Feb 18, 2021 5:56 pm

Re: Close or Abort Form after Clone

Unread post by getNo »

Worked.
Thank you for the fast reply.
Post Reply