Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
If there are no entries in the subform - to hide the subform
-
- Posts: 377
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
If there are no entries in the subform - to hide the subform
If there are no entries in the subform - how to hide the subform ?
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
Re: If there are no entries in the subform - to hide the sub
Code: Select all
var subformId = 'accform'; // <--- replace with your subform object ID
if (nuSubformObject(subformId).rows.length < 2) {
nuHide(subformId);
}
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
Re: If there are no entries in the subform - to hide the sub
Please let me know if the code works for you.
-
- Posts: 377
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: If there are no entries in the subform - to hide the sub
Thanks, it works for me.kev1n wrote:Please let me know if the code works for you.
How would I apply this to all subforms on the main form at once without specifying the ID of each form?
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
Re: If there are no entries in the subform - to hide the sub
Call this function hideEmptySubforms() to hide all empty subforms
Code: Select all
function hideEmptySubforms() {
nuSERVERRESPONSE.objects.map(item => {
if (item.type == 'subform') {
if (nuSubformObject(item.id).rows.length == 1) {
nuHide(item.id);
}
}
})
}
-
- Posts: 377
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: If there are no entries in the subform - to hide the sub
Unfortunately this doesn't work - nothing happens.kev1n wrote:Call this function hideEmptySubforms() to hide all empty subforms
Code: Select all
function hideEmptySubforms() { nuSERVERRESPONSE.objects.map(item => { if (item.type == 'subform') { if (nuSubformObject(item.id).rows.length == 1) { nuHide(item.id); } } }) }
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
Re: If there are no entries in the subform - to hide the sub
How did you call the function and where?
-
- Posts: 377
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: If there are no entries in the subform - to hide the sub
First I tried it without specifying a function, then I hung it up on the button of the main form through onclick.kev1n wrote:How did you call the function and where?
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
Re: If there are no entries in the subform - to hide the sub
You need to call the function somewhere
Code: Select all
hideEmptySubforms();
-
- Posts: 377
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: If there are no entries in the subform - to hide the sub
kev1n wrote:You need to call the function somewhere
Code: Select all
hideEmptySubforms();
You do not have the required permissions to view the files attached to this post.