Welcome to the nuBuilder Forums!

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

Javascript error when embedding nubuilder 4.5 in iframe

Questions related to using nuBuilder Forte.
Jannie
Posts: 33
Joined: Sat Jun 09, 2018 4:36 pm
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Javascript error when embedding nubuilder 4.5 in iframe

Unread post by Jannie »

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
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!
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: 445 times
Contact:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread post by kev1n »

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: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread post by kev1n »

Try modifying nuadmin.js like this:
You do not have the required permissions to view the files attached to this post.
Jannie
Posts: 33
Joined: Sat Jun 09, 2018 4:36 pm
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread post by Jannie »

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
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
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: 445 times
Contact:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread post by kev1n »

I'm trying to fix these errors.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread post by kev1n »

I did some fixes to 3 file (see attachment). Please check if the errors are gone.
You do not have the required permissions to view the files attached to this post.
Jannie
Posts: 33
Joined: Sat Jun 09, 2018 4:36 pm
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread post by Jannie »

@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
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
It arrived when I changed a form
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: 445 times
Contact:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread post by kev1n »

Does the first error occur when you run a report?
Jannie
Posts: 33
Joined: Sat Jun 09, 2018 4:36 pm
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread post by Jannie »

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 223751.jpg
You do not have the required permissions to view the files attached to this post.
Jannie
Posts: 33
Joined: Sat Jun 09, 2018 4:36 pm
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Unread post by Jannie »

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);
				}	 
			}

		}

	};
Post Reply