• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 330
  • Last Modified:

Webtrends not firing on form submit for latest Safari on mac

I have some jquery script that runs on my form submit - firstly validation, then getting the hidden fields ready for the post.
In this script I have a webtrends call that fires fine in all browsers, other than we have discovered recently the latest safari and FF on mac it doesn't fire.

Does anyone know if this is a known issue or have recommendations as to why this might be happening?
Could it be that it doesn't have time to send the request before the form submits?
0
Al4ddin2
Asked:
Al4ddin2
  • 10
  • 8
1 Solution
 
leakim971PluritechnicianCommented:
Could it be that it doesn't have time to send the request before the form submits?

certainly!
0
 
Al4ddin2Author Commented:
Is that a browser/OS specific issue though?
How can I create a delay after the webtrends request to ensure it has enough time?

The below function is called after the on submit validation function has successfully passed.

convertForm = function(formElem) {
	dcsMultiTrack('DCS.dcsuri',param1,'WT.si_n',param2,'WT.si_x',param3); //webtrends call
.....  //need to put in delay here
       //parameters are set here from input field entries
...
       createSubmitFields(formElem, params); //function that then creates hidden fields for the form submission
}

Open in new window

0
 
leakim971PluritechnicianCommented:
Is that a browser/OS specific issue though?

I apologize, forget my answer, I was thinking that you're submitting the values with ajax
Do it work fine if you place an alert for testing purpose :
convertForm = function(formElem) {
       dcsMultiTrack('DCS.dcsuri',param1,'WT.si_n',param2,'WT.si_x',param3);
       alert("pause!");
       createSubmitFields(formElem, params);
}

Open in new window

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Al4ddin2Author Commented:
Yes the alert fires, and all the subsequent script runs successfully - that isn't the issue.
It has been working fine until recently when we noticed that in the latest Safari on a mac the code doesn't appear to be firing when checking it in Fiddler, and the new Firefox on a mac but it works fine on all other browsers.
0
 
leakim971PluritechnicianCommented:
Do have a link to see your page?
0
 
Al4ddin2Author Commented:
unfortunately not, sorry.
0
 
leakim971PluritechnicianCommented:
Could you post the code of createSubmitFields?
0
 
Al4ddin2Author Commented:
qbtb.prototype.createSubmitFields = function(formElem, params) {
	for (i in params) {
		if (params[i].constructor == Array) {
			for (j=0;j<params[i].length;j++) {
				$(formElem).append('<input type="hidden" name="' + i + '[' + j + ']" value="' + params[i][j] + '" />');
			}
		}
		else {
			$(formElem).append('<input type="hidden" name="' + i + '" value="' + params[i] + '" />');
		}
	}
}

Open in new window

0
 
leakim971PluritechnicianCommented:
Try this :
convertForm = function(formElem) {
	dcsMultiTrack('DCS.dcsuri',param1,'WT.si_n',param2,'WT.si_x',param3);
	(function(f, p) {
		setTimeout(function() { createSubmitFields(f, p); }, 1000); // reduce the delay if it work, try 500, 100, 50 instead 1000 
	})(formElem, params);
}

Open in new window

0
 
Al4ddin2Author Commented:
When I introduce this in the script it no longer seems to fire the createSubmitFields function
0
 
leakim971PluritechnicianCommented:
did you placed an alert to be sure just before the setTimeout
0
 
Al4ddin2Author Commented:
I tried it before, and got the alert.
I tried it after, and got the alert.
I even tried it inside the setTimeout function like this but didn't get an alert...

setTimeout(function() { alert("pass"); }, 1000);
0
 
leakim971PluritechnicianCommented:
Try this one :
convertForm = function(formElem) {
	dcsMultiTrack('DCS.dcsuri',param1,'WT.si_n',param2,'WT.si_x',param3);
        var p = params;
        setTimeout(function() { createSubmitFields(formElem, p); }, 1000);
}

Open in new window

0
 
Al4ddin2Author Commented:
Hi,

No it still doesn't seem to be firing the function inside the setTimeout function....?
0
 
leakim971PluritechnicianCommented:
Please confirm what you get in the alerts. Thanks.
	convertForm = function(formElem) {
		alert("param1: " + param1 + " \nparam2: " + param2 + " \nparam3: " + param3 + " \nparams : " + params + "\nform action: " + formElem.action + "\ntypeof $: " + typeof $);
		dcsMultiTrack('DCS.dcsuri',param1,'WT.si_n',param2,'WT.si_x',param3);
		var q = function(f,p) {
			setTimeout(function() { alert("timer ok");createSubmitFields(f, p); }, 1000);
		}
		q(formElem, params);
	}

Open in new window

0
 
Al4ddin2Author Commented:
Hi,

SOrry for the late reply.

I get:

params = object Object
form action = undefined
typeof = function

Thanks
0
 
Al4ddin2Author Commented:
Hi

Any advice on this?

Thanks
0
 
Al4ddin2Author Commented:
Hi,

any further help on this? I still can't get the setTimeOut to trigger.

Thanks
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 10
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now