Welcome to the nuBuilder Forums!

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

Show several functional directories on the form

Questions related to customising nuBuilder Forte with JavaScript or PHP.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Show several functional directories on the form

Unread post by kknm »

How to show several functional directories on one form?
For instance:
1 Departments
2 Computers
3 Equipment
All directories are linked.
Choosing an item in 1 -> 2 directory is filtered.
Choosing item in 2 -> 3 directory is filtered.
kev1n
nuBuilder Team
Posts: 4304
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Show several functional directories on the form

Unread post by kev1n »

Use Hash Cookies in the Computers and Equipment select object. Then call nuRefreshSelectObject() in the onchange event of Departments and Computers to refresh the other select objects.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Show several functional directories on the form

Unread post by kknm »

kev1n wrote:Use Hash Cookies in the Computers and Equipment select object. Then call nuRefreshSelectObject() in the onchange event of Departments and Computers to refresh the other select objects.
First, I want to figure out how to show a copy of the main directory (Departments) on an empty form. If as a subform, then a foreign key is required, but it is not needed here.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Show several functional directories on the form

Unread post by kknm »

kev1n wrote:Use Hash Cookies in the Computers and Equipment select object. Then call nuRefreshSelectObject() in the onchange event of Departments and Computers to refresh the other select objects.
Probably I am misrepresenting my idea. I'll try again ...
I want the form to reflect the complete directory (in the form of a list) Departments and subordinate forms Computers and Equipment. Moreover, if I go to an item with a department, it should not open anything, as browseForm does. I have to get the name of the Department item and submit it to the subform for filtering. I'm primarily interested in - how to create a list of departments - leaning towards the HTML variant, but maybe there is a better way?
kev1n
nuBuilder Team
Posts: 4304
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Show several functional directories on the form

Unread post by kev1n »

kknm wrote:Moreover, if I go to an item with a department, it should not open anything, as browseForm does.
You can easily prevent this by adding this JS to your Browse Form.

Code: Select all

function nuSelectBrowse() {
   return false;
}
I don't exactly understand what you are trying to do. Can you visualise what you are trying to achieve (using paint, excel etc.) ?
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Show several functional directories on the form

Unread post by kknm »

I am migrating several Access databases to nuBuilder and want to achieve similar functionality.
10_45_53.png
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4304
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Show several functional directories on the form

Unread post by kev1n »

For 1) you could use a select Object. Set multiple to true. Then call selectSingle() in the form's Custom Code so that just one item can be selected but to retain the list style.

Code: Select all

function selectSingle(f) {
   $('#' + f).removeAttr('multiple');
   $('#' + f).attr('size', '5');
}
For 2 + 3) Use Browse Forms (iFrame, Run) and use Hash Cookies (e.g. name A_HASH_COOKIE or a meaningful name) in your SQL to filter based on the selection.

In the select object, add an onchange event with a JS like the following to refresh a Browse form.

Code: Select all

document.getElementById("browseIframeId").contentWindow.nuSetProperty('A_HASH_COOKIE',$('#select_obj_id').val());
$("#browseIframeId")[0].contentWindow.nuGetBreadcrumb(0);
You do not have the required permissions to view the files attached to this post.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Show several functional directories on the form

Unread post by kknm »

I already guessed that 'Departments' should be like Select, I played with it for a long time and with nuRefreshSelectObject () from your previous answers, but I could not achieve anything.
Now new introductions that I can't figure out ...

Code: Select all

document.getElementById("browseIframeId").contentWindow.nuSetProperty('A_HASH_COOKIE',$('#select_obj_id').val());
$("#browseIframeId")[0].contentWindow.nuGetBreadcrumb(0);
I have:
1 Select:
Tag: Departments
Id: fltr
2 RUN:
Tag: Computers
Id: sub_kom
Type: iFrame
Filter:fltr
Record_id: empty
NuHash returns the 7 value of the selected field in 'select' as [fltr] => [\"'7\"']
I did this in onchange:

Code: Select all

document.getElementById ('sub_kom'). contentWindow.nuSetProperty ('fltr', $ ('# fltr'). val ());
$ ('# sub_kom') [0] .contentWindow.nuGetBreadcrumb (0);
But nothing happens

How should i change your code for onchange ()?
kev1n
nuBuilder Team
Posts: 4304
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Show several functional directories on the form

Unread post by kev1n »

Code: Select all

$ ('# sub_kom') [0] .contentWindow.nuGetBreadcrumb (0);
There's no space after the #.

Code: Select all

$('#sub_kom')[0].contentWindow.nuGetBreadcrumb(0);
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Show several functional directories on the form

Unread post by kknm »

Of course, there are no spaces in the function - it's either the translator or the browser substitutes it.

Code: Select all

document.getElementById("sub_kom").contentWindow.nuSetProperty('fltr',$('#fltr').val());
$("#sub_kom")[0].contentWindow.nuGetBreadcrumb(0);
Post Reply