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.
Browse/edit form as subform Topic is solved
Browse/edit form as subform
Hi All
I'm new to nuBuilder (and web development in general) so hopefully this is an easy question.
I'd like to create a browse-edit form that acts as a subform of another browse/edit form.
Say there are Projects, and each project has items of equipment, and each item of equipment has components.
So I have a browse/form called Projects. In the Project edit form I have a button that opens another browse/edit form called Equipment. And in the Equipment edit form I have another button that opens Components.
How do I make it so that the Equipment form only includes items relating to the Project that it is under, and the Component form only includes items relating to the Equipment that it is under?
Thanks in advance.
I'm new to nuBuilder (and web development in general) so hopefully this is an easy question.
I'd like to create a browse-edit form that acts as a subform of another browse/edit form.
Say there are Projects, and each project has items of equipment, and each item of equipment has components.
So I have a browse/form called Projects. In the Project edit form I have a button that opens another browse/edit form called Equipment. And in the Equipment edit form I have another button that opens Components.
How do I make it so that the Equipment form only includes items relating to the Project that it is under, and the Component form only includes items relating to the Equipment that it is under?
Thanks in advance.
Re: Browse/edit form as subform
Hi elbrownos,
Can you share a copy of you database or provide some screen shots?
Steven
Can you share a copy of you database or provide some screen shots?
Steven
A short post is a good post.
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Browse/edit form as subform
Hi, thanks for your help. Sorry I couldn't follow how to use hash cookies to do this.
I've attached my database.
The first option uses iframes, the second uses buttons. I would prefer to get the buttons option working.
The behaviour I'm trying to implement is:
If I go into Projects and create two projects (say "Project 1" & "Project 2").
Then from "Project 1" I create an equipment "Project 1 Equipment 1" and from "Project 2" I create "Project 2 Equipment 1"
When I go into a project I only want to be able to see the equipment that belongs to that project.
Likewise for a further level of "Components" that belong to "Equipment"
Hope that makes sense.
I've attached my database.
The first option uses iframes, the second uses buttons. I would prefer to get the buttons option working.
The behaviour I'm trying to implement is:
If I go into Projects and create two projects (say "Project 1" & "Project 2").
Then from "Project 1" I create an equipment "Project 1 Equipment 1" and from "Project 2" I create "Project 2 Equipment 1"
When I go into a project I only want to be able to see the equipment that belongs to that project.
Likewise for a further level of "Components" that belong to "Equipment"
Hope that makes sense.
You do not have the required permissions to view the files attached to this post.
Re: Browse/edit form as subform
Perhaps a simpler question -
A subform table has a foreign key field for the master record ID.
What is the mechanism for the master record ID to be copied to the subform foreign key ID, and what is the mechanism for the subform to only display records where the foreign key ID matches the master record ID?
This is the behavior I want to duplicate with browse/edit forms.
A subform table has a foreign key field for the master record ID.
What is the mechanism for the master record ID to be copied to the subform foreign key ID, and what is the mechanism for the subform to only display records where the foreign key ID matches the master record ID?
This is the behavior I want to duplicate with browse/edit forms.
Re: Browse/edit form as subform
Hy, you could do some thing like this; in the Js of browse/ edit form of child form, use the below code, replace the brdngn_id with the id of your foreign key ie. field that will hold your parent id.elbrownos wrote: ↑Tue Dec 03, 2024 10:02 pm Perhaps a simpler question -
A subform table has a foreign key field for the master record ID.
What is the mechanism for the master record ID to be copied to the subform foreign key ID, and what is the mechanism for the subform to only display records where the foreign key ID matches the master record ID?
This is the behavior I want to duplicate with browse/edit forms.
Code: Select all
var parentid = parent.nuCurrentProperties().record_id;
if ($('#brdngn_id').val() ===''){
$('#brdngn_id').val(parentid).change();
}
Regards
Nilesh
Re: Browse/edit form as subform
Thanks Nilesh! it works if my child form is an iFrame.
How would I do the same thing if my child form is opened via a button?
How would I do the same thing if my child form is opened via a button?
Re: Browse/edit form as subform
Hi elbrownos,
Change the SQL to include Hash Cookies - as kev1n mentioned.
And you'll get this...
Steven
Change the SQL to include Hash Cookies - as kev1n mentioned.
Code: Select all
SELECT * FROM Equipment
WHERE eqp_equipment_short_code like '#prj_project_short_code#%'
And you'll get this...
Steven
You do not have the required permissions to view the files attached to this post.
A short post is a good post.
Re: Browse/edit form as subform
you can can create a function and call it on onclick event of the button;
Code: Select all
function addnewreadings() {
var rid = nuCurrentProperties().record_id;
if (rid === '' || rid === '-1') {
alert('Please save the fumigation details first before updating the Concentration reading');
return;
//nuSaveAction();
} else {
sessionStorage.setItem("fum_id", rid);
nuPopup('64f6912de704de1', '-1', '', '');
}
}
function newreading() {
nuPopup('64f6912de704de1', '-1', '', '');
}
Code: Select all
if (nuFormType() === 'edit') {
// Set address if opened from an address
var refA = sessionStorage.getItem("fum_id");
console.log(refA);
if (refA !== null && refA !== '-1') {
$('#fumigations_id').val(refA).change();
} else {
nuClosePopup(parent.nuGetBreadcrumb());
}
}