Subform Button always open to a New Edit Blank Screen

Questions related to using nuBuilder Forte.

Subform Button always open to a New Edit Blank Screen

Unread postby skyline101 » Fri Jul 23, 2021 4:31 am

Hi

I have carefully followed https://forums.nubuilder.com/viewtopic.php?f=19&t=10542&p=21823&hilit=subform+button#p21823 and https://forums.nubuilder.com/viewtopic.php?f=19&t=9212&p=15332 and https://forums.nubuilder.com/viewtopic.php?f=19&t=10946&p=23787&hilit=filter#p23787I and https://forums.nubuilder.com/viewtopic.php?f=19&t=10946&p=23794&hilit=ONCLICK#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.net/nubuilderforte/index.php/Tutorials_and_Videos are displaying and "invalid login" messages.
Attachments
Image1.PNG
Image1.PNG (12.84 KiB) Viewed 212 times
skyline101
 
Posts: 27
Joined: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

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

Unread postby kev1n » Fri Jul 23, 2021 6:15 am

Hi,

skyline101 wrote:By the way, both of your Sample Code demos on your https://wiki.nubuilder.net/nubuilderforte/index.php/Tutorials_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
onclick.png (34.24 KiB) Viewed 207 times


Inspect the SQL in the popup window by pressing CTRL+SHIFT+I to see what it looks like.
kev1n
nuBuilder Team
 
Posts: 1996
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

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

Unread postby skyline101 » Fri Jul 23, 2021 6:33 am

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.com/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
skyline101
 
Posts: 27
Joined: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

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

Unread postby kev1n » Fri Jul 23, 2021 7:21 am

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
kev1n
nuBuilder Team
 
Posts: 1996
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

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

Unread postby skyline101 » Fri Jul 23, 2021 7:31 am

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.
Attachments
Image1.PNG
Image1.PNG (12.84 KiB) Viewed 200 times
skyline101
 
Posts: 27
Joined: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

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

Unread postby kev1n » Fri Jul 23, 2021 7:33 am

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, '');
kev1n
nuBuilder Team
 
Posts: 1996
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

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

Unread postby skyline101 » Fri Jul 23, 2021 7:53 am

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.net/nubuilderforte/index.php/Javascript#nuFilterRun without any success.
skyline101
 
Posts: 27
Joined: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

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

Unread postby kev1n » Fri Jul 23, 2021 7:57 am

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.
kev1n
nuBuilder Team
 
Posts: 1996
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

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

Unread postby kev1n » Fri Jul 23, 2021 8:04 am

kev1n
nuBuilder Team
 
Posts: 1996
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

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

Unread postby skyline101 » Fri Jul 23, 2021 8:27 am

I have always added all JS to the button's Custom Code onclick event. Attached are the files.
Attachments
Files.zip
(5.04 KiB) Downloaded 10 times
skyline101
 
Posts: 27
Joined: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

Next

Return to General

Who is online

Users browsing this forum: No registered users and 17 guests