Welcome to the nuBuilder Forums!

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

Extra Action Button to Close Current Form

lrosemond
Posts: 2
Joined: Fri Feb 19, 2010 7:39 pm

Extra Action Button to Close Current Form

Unread post by lrosemond »

I'm new to nuBuilder, and I'm really liking it. I was wondering if I could get some help on creating an Extra Action Button to close the current edit form. Yes I know that anyone could just simply click the "X" in the upper right corner to achieve the same results. However, I have users who would customarily look for a actual "cancel" button on the menu and not think to hit the "X" to end an operation. Plus, I'd like to learn how to work with Extra Action Buttons. Your help will be very much appreciated.
:)
steven
Posts: 370
Joined: Mon Jun 15, 2009 10:03 am
Has thanked: 52 times
Been thanked: 52 times

Re: Extra Action Button to Close Current Form

Unread post by steven »

Irosemond,

You're not the first to want this, so we made a nuBuilder 'Plugin' that you can download and use.

Logout and Close All Buttons

http://www.nubuilder.com/nubuilderwww/i ... av=plugins

Hopefully this helps


Steven
A short post is a good post.
cypherinfo
Posts: 125
Joined: Thu Feb 18, 2010 5:42 pm
Contact:

Re: Extra Action Button to Close Current Form

Unread post by cypherinfo »

Hello,


I have tried to follow the instructions to add the "Close" button in one of my form (ripiani and scaffali) and it is displaied in the wrong place.
I mean: I accessed the ripiani setup in the JavaScript tab; I copied the closealllogiutPlugin.txt code and logout.

I logged in again and I found the button only after having clicked the add record button in the scaffali form see the "add record" attachment; that is in the screen to add a record.

I wonder how to add those buttons in the right form; see the scaffali attachment.


Thank you.



Cypherinfo.
You do not have the required permissions to view the files attached to this post.
steven
Posts: 370
Joined: Mon Jun 15, 2009 10:03 am
Has thanked: 52 times
Been thanked: 52 times

Re: Extra Action Button to Close Current Form

Unread post by steven »

Cypherinfo,

I'm sorry but I didn't quite understand your question.
Do you want to put this close button on a browse screen?

I'm not sure why you highlighted the Add Record Button.

The JavaScript (for the close button) needs to be added to the sfo_javascript field of the Index page, which cannot be accessed through nuBuilder (you'll need to use phpmyadmin)

Let me know if I still haven't been any help.

Steven
A short post is a good post.
cypherinfo
Posts: 125
Joined: Thu Feb 18, 2010 5:42 pm
Contact:

Re: Extra Action Button to Close Current Form

Unread post by cypherinfo »

Hello,


in your documentation is described how to place those buttons in the INDEX; I would like to know how to put them in a tab of my choice please.
See the attached video; there I show where it is needed to add those buttons.


Thank you.



Cypherinfo.
You do not have the required permissions to view the files attached to this post.
steven
Posts: 370
Joined: Mon Jun 15, 2009 10:03 am
Has thanked: 52 times
Been thanked: 52 times

Re: Extra Action Button to Close Current Form

Unread post by steven »

Cypherinfo,

Put this code in Before Browse section of the Browse Screen you want it on.

Code: Select all



	$s = <<<EOJS
	function nuLoadThis(){
	pleaseWait();
	logOutButton();
	closeAllButton();
}


function logOutButton() {
	var thisHTML = "<input type=\"button\" value=\"logout\" style=\"width:60;\" name=\"logout\" id=\"logout\"  onclick=\"window.open('close1.html', '_parent')\" class=\"button\"/>";
	
	newObj = document.createElement("div");
	newObj.setAttribute('id', "logoutBtn");
	newObj.innerHTML = thisHTML;
	document.body.appendChild(newObj);
	
	document.getElementById('logoutBtn').style.position = 'absolute';
	document.getElementById('logoutBtn').style.top = '0';
	document.getElementById('logoutBtn').style.left = '922';
	document.getElementById('logoutBtn').style.visibility = 'visible';
}

function closeAllButton() {
	var thisHTML = "<input type=\"button\" value=\"Close All\" style=\"width:60;\" name=\"Close All\" id=\"Close All\"  onclick=\"closeAllDo()\" class=\"button\"/>";
	
	newObj = document.createElement("div");
	newObj.setAttribute('id', "closeAllBtn");
	newObj.innerHTML = thisHTML;
	document.body.appendChild(newObj);
	
	document.getElementById('closeAllBtn').style.position = 'absolute';
	document.getElementById('closeAllBtn').style.top = '26';
	document.getElementById('closeAllBtn').style.left = '922';
	document.getElementById('closeAllBtn').style.visibility = 'visible';
}

function pleaseWait() {

	var thisHTML = "<table bgcolor=\"red\" width=\"300\"><tr><td align=\"center\"><br><br><br><br><br><br>Please wait<br><br><br></td></tr></table>";
	
	newObj = document.createElement("div");
	newObj.setAttribute('id', "pleaseWait");
	newObj.innerHTML = thisHTML;
	document.body.appendChild(newObj);
	
	document.getElementById('pleaseWait').style.position = 'absolute';
	document.getElementById('pleaseWait').style.top = '200';
	document.getElementById('pleaseWait').style.left = '300';
	document.getElementById('pleaseWait').style.width = '1200px';
	document.getElementById('pleaseWait').style.height = '800px';
	document.getElementById('pleaseWait').style.filter = 'alpha(opacity=90)';
	document.getElementById('pleaseWait').style.visibility = 'hidden';
}

function pleaseWaitStart() {
	nuEraseCookie("nuC");
        document.getElementById('pleaseWait').style.visibility = 'visible';
        return true;
}
function pleaseWaitStop() {
        nuCreateCookie("nuC",1,1);
        document.getElementById('pleaseWait').style.visibility = 'hidden';
        return true;
}

function closeAllDo() {
	pleaseWaitStart();
        setTimeout('pleaseWaitStop()',3000);
}





EOJS;
addJSfunction($s);


		


Steven
A short post is a good post.
jlcsusara
Posts: 23
Joined: Wed Apr 07, 2010 10:32 am

Re: Extra Action Button to Close Current Form

Unread post by jlcsusara »

steven wrote:Cypherinfo,

Put this code in Before Browse section of the Browse Screen you want it on.

Steven
That was quick... and cool! I can use this too. Thanks!
cypherinfo
Posts: 125
Joined: Thu Feb 18, 2010 5:42 pm
Contact:

Re: Extra Action Button to Close Current Form

Unread post by cypherinfo »

Hello,

I followed your instructions and no button has been displayed.
See the attached video.

Thank you.


Cypherinfo.
You do not have the required permissions to view the files attached to this post.
steven
Posts: 370
Joined: Mon Jun 15, 2009 10:03 am
Has thanked: 52 times
Been thanked: 52 times

Re: Extra Action Button to Close Current Form

Unread post by steven »

I've had a look at that video and I cant see what is wrong,

try putting this in ...

Code: Select all


	$s = <<<EOJS
	function nuLoadThis(){
	alert(1234);
}

EOJS;
addJSfunction($s);

(If something doesn't work, you need to learn to try something much smaller, this is the way to properly debug something - bit by bit)
A short post is a good post.
cypherinfo
Posts: 125
Joined: Thu Feb 18, 2010 5:42 pm
Contact:

Re: Extra Action Button to Close Current Form

Unread post by cypherinfo »

Hello,


I have add your code and the buttons have been displaied. All right after clicking on it once; when exit and log in again it happens as you may watch in the video.


Thank you.


Cypherinfo.
You do not have the required permissions to view the files attached to this post.
Post Reply