Page 1 of 2

Javascript error when embedding nubuilder 4.5 in iframe

Posted: Tue Aug 17, 2021 9:03 pm
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!

Re: Javascript error when embedding nubuilder 4.5 in iframe

Posted: Tue Aug 17, 2021 9:25 pm
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.

Re: Javascript error when embedding nubuilder 4.5 in iframe

Posted: Tue Aug 17, 2021 10:13 pm
by kev1n
Try modifying nuadmin.js like this:

Re: Javascript error when embedding nubuilder 4.5 in iframe

Posted: Wed Aug 18, 2021 9:02 am
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

Re: Javascript error when embedding nubuilder 4.5 in iframe

Posted: Thu Aug 19, 2021 8:18 am
by kev1n
I'm trying to fix these errors.

Re: Javascript error when embedding nubuilder 4.5 in iframe

Posted: Thu Aug 19, 2021 8:52 am
by kev1n
I did some fixes to 3 file (see attachment). Please check if the errors are gone.

Re: Javascript error when embedding nubuilder 4.5 in iframe

Posted: Thu Aug 19, 2021 7:32 pm
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

Re: Javascript error when embedding nubuilder 4.5 in iframe

Posted: Fri Aug 20, 2021 8:09 am
by kev1n
Does the first error occur when you run a report?

Re: Javascript error when embedding nubuilder 4.5 in iframe

Posted: Fri Aug 20, 2021 10:45 pm
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

Re: Javascript error when embedding nubuilder 4.5 in iframe

Posted: Mon Aug 30, 2021 3:08 pm
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);
				}	 
			}

		}

	};