Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Secondary "home" form launched by a button
-
- Posts: 38
- Joined: Tue Jun 05, 2012 2:40 pm
- Location: Bologna, Italy
- Contact:
Secondary "home" form launched by a button
Hi,
is there a way to launch a secondary "home" form from a button?
Or better, I want to put in a launch form 2 buttons, say "DEPARTMENT 1", "DEPARTMENT 2", and clicking on each button will launch a new "nuhome2" or "nuhome3" in which I put same buttons (say HR, INVOICES, and so on), each filtered by department name.
Thank you
Alessandro
is there a way to launch a secondary "home" form from a button?
Or better, I want to put in a launch form 2 buttons, say "DEPARTMENT 1", "DEPARTMENT 2", and clicking on each button will launch a new "nuhome2" or "nuhome3" in which I put same buttons (say HR, INVOICES, and so on), each filtered by department name.
Thank you
Alessandro
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Secondary "home" form launched by a button
Hi Alessandro,
You could try this:
Launch Form: Add an onclick handler to each button to set the department.
Lauch Screen nuhome2: Add some custom code to retrieve set the department name as Hash Cookie
Buttons on nuhome2:
Add a Filter #DEPARTMENT#
You could try this:
Launch Form: Add an onclick handler to each button to set the department.
Lauch Screen nuhome2: Add some custom code to retrieve set the department name as Hash Cookie
Code: Select all
if (nuFormType() == 'edit') {
nuSetProperty("DEPARTMENT", window.department);
}
Add a Filter #DEPARTMENT#
You do not have the required permissions to view the files attached to this post.
-
- Posts: 38
- Joined: Tue Jun 05, 2012 2:40 pm
- Location: Bologna, Italy
- Contact:
Re: Secondary "home" form launched by a button
Kevin,
I tried to do as you say, but when I open form from a button in nuHome2 filtered by #DEPARTMENT#, it displays nothing.
If I do a nuDebug(nuHash()) in BB of the form, there is [filter] => #DEPARTMENT#, that isn't the value of the hash variable but the variable itself.
Maybe there is something wrong I did.
I tried to do as you say, but when I open form from a button in nuHome2 filtered by #DEPARTMENT#, it displays nothing.
If I do a nuDebug(nuHash()) in BB of the form, there is [filter] => #DEPARTMENT#, that isn't the value of the hash variable but the variable itself.
Maybe there is something wrong I did.
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Secondary "home" form launched by a button
Alessandro,
You must be doing something different. This is my understanding:
Launch Screen (Launch 0) :
Button "Launch Form1" (with onclick event, containing a JS that sets window.department)
Button opens "Launch 1"
Launch Screen (Launch 1) :
Custom Code in Launch Form
Button "Button00" (with Filter #DEPARTMENT#)
Button opens A Browse Screen
Browse Screen
Add nuDebug(nuHash()) to view the filter
You must be doing something different. This is my understanding:
Launch Screen (Launch 0) :
Button "Launch Form1" (with onclick event, containing a JS that sets window.department)
Button opens "Launch 1"
Launch Screen (Launch 1) :
Custom Code in Launch Form
Button "Button00" (with Filter #DEPARTMENT#)
Button opens A Browse Screen
Browse Screen
Add nuDebug(nuHash()) to view the filter
You do not have the required permissions to view the files attached to this post.
-
- Posts: 38
- Joined: Tue Jun 05, 2012 2:40 pm
- Location: Bologna, Italy
- Contact:
Re: Secondary "home" form launched by a button
Kevin,
I did EXACTLY what you wrote and I see that if I do: launch0->button0->launch1->button1->browse form, the browse is empty and the nuDebug(nuHash()) shows this:
But if I go a step back in the breadcrumb and then return to browse screen, filter appears to be correct like you can see here:
I did EXACTLY what you wrote and I see that if I do: launch0->button0->launch1->button1->browse form, the browse is empty and the nuDebug(nuHash()) shows this:
But if I go a step back in the breadcrumb and then return to browse screen, filter appears to be correct like you can see here:
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Secondary "home" form launched by a button
Add some code to debug. The first thing to check is to see if window.department contains the department string:
if (nuFormType() == 'edit') {
nuSetProperty("DEPARTMENT", window.department);
alert('Launch 1, window.department: ' + window.department);
}
if (nuFormType() == 'edit') {
nuSetProperty("DEPARTMENT", window.department);
alert('Launch 1, window.department: ' + window.department);
}
-
- Posts: 38
- Joined: Tue Jun 05, 2012 2:40 pm
- Location: Bologna, Italy
- Contact:
Re: Secondary "home" form launched by a button
Kevin,
I tried to do as you say:
alert('Launch 1, window.department: ' + window.department); IT'S OKAY, it displays the right string.
This is the RUN tab of button from launch1:
and this is the result from console log after click on button:
If i click on previous breadcrumb entry and then re-click button:
I tried to do as you say:
alert('Launch 1, window.department: ' + window.department); IT'S OKAY, it displays the right string.
This is the RUN tab of button from launch1:
and this is the result from console log after click on button:
If i click on previous breadcrumb entry and then re-click button:
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Secondary "home" form launched by a button
New attempt: Change the JavaScript code as follows:
-> Replace the Button IDs (Button01, Button02 etc.)
-> Replace the Button IDs (Button01, Button02 etc.)
Code: Select all
function replaceBtnHashCookie(id, hCookie, value) {
var c = $('#' + id).attr('onclick');
$('#' + id).attr('onclick', c.replace(hCookie, value));
}
if (nuFormType() == 'edit') {
var hCookie = "DEPARTMENT"
nuSetProperty(hCookie, window.department);
replaceBtnHashCookie('Button01', '#' + hCookie + '#', window.department);
replaceBtnHashCookie('Button02', '#' + hCookie + '#', window.department);
}
-
- Posts: 38
- Joined: Tue Jun 05, 2012 2:40 pm
- Location: Bologna, Italy
- Contact:
Re: Secondary "home" form launched by a button
PERFECTLY WORKING!
Nice one!
Thank you Kevin!
Alessandro
Nice one!
Thank you Kevin!
Alessandro