Page 1 of 2
Extra Action Button to Close Current Form
Posted: Tue Feb 23, 2010 5:14 pm
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.

Re: Extra Action Button to Close Current Form
Posted: Thu Feb 25, 2010 12:28 pm
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
Re: Extra Action Button to Close Current Form
Posted: Wed Jul 21, 2010 12:58 pm
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.
Re: Extra Action Button to Close Current Form
Posted: Thu Jul 22, 2010 1:50 am
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
Re: Extra Action Button to Close Current Form
Posted: Thu Jul 22, 2010 10:24 am
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.
Re: Extra Action Button to Close Current Form
Posted: Fri Jul 23, 2010 6:37 am
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
Re: Extra Action Button to Close Current Form
Posted: Fri Jul 23, 2010 7:50 am
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!
Re: Extra Action Button to Close Current Form
Posted: Fri Jul 23, 2010 12:15 pm
by cypherinfo
Hello,
I followed your instructions and no button has been displayed.
See the attached video.
Thank you.
Cypherinfo.
Re: Extra Action Button to Close Current Form
Posted: Mon Jul 26, 2010 7:08 am
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)
Re: Extra Action Button to Close Current Form
Posted: Mon Jul 26, 2010 11:20 am
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.