Javascript error when embedding nubuilder 4.5 in iframe

Questions related to using nuBuilder Forte.

Javascript error when embedding nubuilder 4.5 in iframe

Unread postby Jannie » Wed Aug 18, 2021 4:33 am

I recently updated my nubuilder-database from version 4 to 4.5. Nearly everything works fine if I call it direct from its location but when I embed it in an iframe is see this error:
Schermafbeelding 2021-08-17 205339.jpg
Schermafbeelding 2021-08-17 205339.jpg (38.07 KiB) Viewed 276 times

Error hyperlink goes to "var frame = parent.$('#nuDragDialog iframe')" in nuadmin.js (line 88)
Ik can't find the reason of this. Maybe someone else?
Thanks in advance!
Jannie
 
Posts: 24
Joined: Sun Jun 10, 2018 12:06 am
Location: Netherlands
nuBuilder Version: 4.5

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread postby kev1n » Wed Aug 18, 2021 4:55 am

Could you exclude that line 88 for now and also the next 3 lines? I will look into it a bit later to see what is going wrong.
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread postby kev1n » Wed Aug 18, 2021 5:43 am

Try modifying nuadmin.js like this:
Attachments
nuadmin.js_change.jpg
nuadmin.js_change.jpg (35.5 KiB) Viewed 271 times
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread postby Jannie » Wed Aug 18, 2021 4:32 pm

Thank you @Kev1n for fast reply!

After modifying admin.js it works like a charm in 'normal' user mode (no errors, thank you!)

For testing I went to changed (v4->v4.5) Nubuilder-locations and found some other window-related errors:

When I go to setup, forms and choose to edit a form (with the nice new buttons) I see those errors:
Schermafbeelding 2021-08-18 083850.jpg
Schermafbeelding 2021-08-18 083850.jpg (213.68 KiB) Viewed 258 times


and when I (after clearing console) go to a form in 'normal' user mode and try to edit an object (with the nice new location-buttons) I see this error:
Schermafbeelding 2021-08-18 084605.jpg
Schermafbeelding 2021-08-18 084605.jpg (58.68 KiB) Viewed 258 times
Jannie
 
Posts: 24
Joined: Sun Jun 10, 2018 12:06 am
Location: Netherlands
nuBuilder Version: 4.5

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread postby kev1n » Thu Aug 19, 2021 3:48 pm

I'm trying to fix these errors.
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread postby kev1n » Thu Aug 19, 2021 4:22 pm

I did some fixes to 3 file (see attachment). Please check if the errors are gone.
Attachments
core.zip
(25.88 KiB) Downloaded 15 times
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread postby Jannie » Fri Aug 20, 2021 3:02 am

@Kev1in, thank you very much!
Nearly every error is gone!
Up to now I only found this (new) one about windows:
Schermafbeelding 2021-08-19 191728.jpg
Schermafbeelding 2021-08-19 191728.jpg (32.39 KiB) Viewed 233 times

It's on a form with an iframe in a html-object


I also found another error about a function which isn't available:
Schermafbeelding 2021-08-19 192522.jpg
Schermafbeelding 2021-08-19 192522.jpg (30.9 KiB) Viewed 233 times

It arrived when I changed a form
Jannie
 
Posts: 24
Joined: Sun Jun 10, 2018 12:06 am
Location: Netherlands
nuBuilder Version: 4.5

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread postby kev1n » Fri Aug 20, 2021 3:39 pm

Does the first error occur when you run a report?
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread postby Jannie » Sat Aug 21, 2021 6:15 am

No it's not during creation of a pdf.
I only open a launch-form with a html-object. Inside this object I placed an iframe:
Schermafbeelding 2021-08-20 223737.jpg
Schermafbeelding 2021-08-20 223737.jpg (91.5 KiB) Viewed 219 times

Schermafbeelding 2021-08-20 223751.jpg
Schermafbeelding 2021-08-20 223751.jpg (45.22 KiB) Viewed 219 times
Jannie
 
Posts: 24
Joined: Sun Jun 10, 2018 12:06 am
Location: Netherlands
nuBuilder Version: 4.5

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread postby Jannie » Mon Aug 30, 2021 10:38 pm

I think I have found a solution for the first error. It's a small bug in nuajax.js.
I changed those lines and error is gone!

Code: Select all
var successCallback      = function(data,textStatus,jqXHR){

      var fm            = data;

      if(!nuDisplayError(fm)){

         var pdfUrl      = 'core/nurunphp.php?i=' + fm.id;

         if(iframe === undefined || iframe === ''){
            window.open(pdfUrl);
         }else{
            //Jannie thinks that parent can be removed, but maybe it's sometimes needed?
            if (document.getElementById(iframe)){
               $('#' + iframe).attr('src', pdfUrl);
            }   
            else {
               parent.$('#' + iframe).attr('src', pdfUrl);
            }   
         }

      }

   };
Jannie
 
Posts: 24
Joined: Sun Jun 10, 2018 12:06 am
Location: Netherlands
nuBuilder Version: 4.5

Next

Return to General

Who is online

Users browsing this forum: No registered users and 20 guests