Welcome to the nuBuilder Forums!

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

Subform Button always open to a New Edit Blank Screen

Questions related to using nuBuilder Forte.
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Subform Button always open to a New Edit Blank Screen

Unread post by skyline101 »

Hi

I have carefully followed https://forums.nubuilder.cloud/viewtopic. ... ton#p21823 and https://forums.nubuilder.cloud/viewtopic. ... 12&p=15332 and https://forums.nubuilder.cloud/viewtopic. ... ter#p23787I and https://forums.nubuilder.cloud/viewtopic. ... ICK#p23794.

I have applied variations of all of the above topics and have applied the code below. I can either A) Bring up the targeted Object ID screen showing a summary of all records but it does not filter to the #RECORD_ID# and B)I can bring the Edit screen but it always appears blank.

The code I have added onto the button onclick is:

Code: Select all

var id = event.target.parentNode.id;
var pk = $('#' + String(id)).attr('data-nu-primary-key');
nuPopup('60d4980f32da524', pk, '#RECORD_ID#');
OR
To try something different, I have also used for the button onclick:

Code: Select all

openInterface(event);
and for the target form (Custom Code)

Code: Select all

function openInterface(event) {

    var et = $(event.target);

    var interfaceID = $('#'+et.attr('data-nu-prefix') + 'isv_interfaces_id').val();

   nuPopup('60d4980f32da524', interfaceID, '');


} 
I thank you in advance for any help you can provide.

By the way, both of your Sample Code demos on your https://wiki.nubuilder.cloud/ ... and_Videos are displaying and "invalid login" messages.
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Subform Button always open to a New Edit Blank Screen

Unread post by kev1n »

Hi,
skyline101 wrote:By the way, both of your Sample Code demos on your https://wiki.nubuilder.cloud/ ... and_Videos are displaying and "invalid login" messages.
Thanks for pointing out, I'll have a look at it.

I've just tested it with the Subform in the "Objects Demo".

The Browse form opens with filter on "Frankel".

Code: Select all

var id = event.target.parentNode.id;
var pk = $('#' + String(id)).attr('data-nu-primary-key');
nuPopup('605f5c9cd9e8b68', '', 'Frankel');
onclick.png
Inspect the SQL in the popup window by pressing CTRL+SHIFT+I to see what it looks like.
You do not have the required permissions to view the files attached to this post.
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Re: Subform Button always open to a New Edit Blank Screen

Unread post by skyline101 »

Hi Kevin

It does work for one specific record but it does not work for the record being held on the subform look up record which I believe it should be '#RECORD_ID#'.

After browsing almost the entire forum, on the same subject, I just found OUT your reply to someone else https://forums.nubuilder.cloud/viewtopic.php?f=19&t=10950.

I applied your code below, changed the objectsID's inside the button as an onclick event and after clicking it, the form does not launch at all.

Code: Select all

$("[data-nu-form=60f87c842959870]").click(function(){
   var id = event.target.parentNode.id;
   var pk = $('#' + String(id)).attr('data-nu-primary-key');
   nuPopup('60d4980f32da524', pk, ''); // <-- replace 605f5c9cd9e8b68 with ID of your Orders Form.
});;

Not sure if I need to add any other code to the target form's Custom Code section.

Once again, thanks for your help
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Subform Button always open to a New Edit Blank Screen

Unread post by kev1n »

To be honest, I read everything like 10 times and fail to understand what you are trying to accomplish.

- Do you want to open the popup as browse or edit?
- Which record should be displayed?
- Did you inspect the generated SQL?
- #RECORD_ID# is the record Id of the main form and $('#' + String(id)).attr('data-nu-primary-key') the record Id of the subform row
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Re: Subform Button always open to a New Edit Blank Screen

Unread post by skyline101 »

As per my attached graphic, when I click the open button, on the subform (interface), I would like to go to the edit form of interfaces so I can edit Interface123.
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Subform Button always open to a New Edit Blank Screen

Unread post by kev1n »

To open the form in Edit mode, leave parameter 3 blank. Make sure the id in parameter 1 is correct.
In Parameter 2 we pass the primary key of the subform record.

Code: Select all

var id = event.target.parentNode.id;
var pk = $('#' + String(id)).attr('data-nu-primary-key');
nuPopup('605f5c9cd9e8b68', pk, '');
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Re: Subform Button always open to a New Edit Blank Screen

Unread post by skyline101 »

I did try with and without 3rd parameter and the edit form comes up blank without any record on it. This is why I also tried your other code

Code: Select all

$("[data-nu-form=60f87c842959870]").click(function(){
   var id = event.target.parentNode.id;
   var pk = $('#' + String(id)).attr('data-nu-primary-key');
   nuPopup('60d4980f32da524', pk, ''); // <-- replace 605f5c9cd9e8b68 with ID of your Orders Form.
});;
With nuBuilder, I have managed to create some forms, tables, fields and have linked them without any problems. This is the first time I have completely stumble with a button on a subform to bring me to the record's edit form. I also tried many of nuBuilder Javascript functions https://wiki.nubuilder.cloud/ ... uFilterRun without any success.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Subform Button always open to a New Edit Blank Screen

Unread post by kev1n »

Add the JS in the button's onclick event as shown on my screenshot above.

If it still fails, please upload the form sql (using the cloner) here together with the tables that are used and some dummy data.
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Re: Subform Button always open to a New Edit Blank Screen

Unread post by skyline101 »

I have always added all JS to the button's Custom Code onclick event. Attached are the files.
You do not have the required permissions to view the files attached to this post.
Post Reply