Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Webtrends not firing on form submit for latest Safari on mac

Posted on 2013-01-29
18
Medium Priority
?
323 Views
Last Modified: 2013-08-15
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
Comment
Question by:Al4ddin2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 8
18 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 38832016
Could it be that it doesn't have time to send the request before the form submits?

certainly!
0
 

Author Comment

by:Al4ddin2
ID: 38832075
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
 
LVL 82

Expert Comment

by:leakim971
ID: 38832180
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 top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 

Author Comment

by:Al4ddin2
ID: 38834440
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
 
LVL 82

Expert Comment

by:leakim971
ID: 38834637
Do have a link to see your page?
0
 

Author Comment

by:Al4ddin2
ID: 38834641
unfortunately not, sorry.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38834814
Could you post the code of createSubmitFields?
0
 

Author Comment

by:Al4ddin2
ID: 38834835
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
 
LVL 82

Expert Comment

by:leakim971
ID: 38834882
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
 

Author Comment

by:Al4ddin2
ID: 38835260
When I introduce this in the script it no longer seems to fire the createSubmitFields function
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38835658
did you placed an alert to be sure just before the setTimeout
0
 

Author Comment

by:Al4ddin2
ID: 38835722
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
 
LVL 82

Expert Comment

by:leakim971
ID: 38835793
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
 

Author Comment

by:Al4ddin2
ID: 38835954
Hi,

No it still doesn't seem to be firing the function inside the setTimeout function....?
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 38837793
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
 

Author Comment

by:Al4ddin2
ID: 38863805
Hi,

SOrry for the late reply.

I get:

params = object Object
form action = undefined
typeof = function

Thanks
0
 

Author Comment

by:Al4ddin2
ID: 38899606
Hi

Any advice on this?

Thanks
0
 

Author Comment

by:Al4ddin2
ID: 39002167
Hi,

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

Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question