473,763 Members | 1,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tracking form submit...

Hi,

In Firefox, what's the best way of tracking the form submit?
The following are two ways I tried, but they won't work if the form is
submitted through JavaScript.

Method 1: using the window.onsubmit event handler

Code: window.onsubmit =handleEvent;

Method 2: I am attachin event listeners to all the forms for the event
submit.

Code:

for(var i=0;i<forms.len gth;i++)
{
var form=forms[i];
form.addEventLi stener("submit" ,handleEvent,fa lse);
}

It seems submit event is not generated if the form doesn't have a
submit button. Why so?

What's the best way through which what ever way the form is submitted,
I should be able to track it.

Thanks & Regards,
Rajendra Prasad Murakonda
http://prodizy.livejournal.com/

Aug 31 '06 #1
3 7425
Add an event handler to the form tag like this.
<form name="aform" action="a/place.cgi" method="POST"
onsubmit="handl eEvent()">
The submit button triggers the onsubmit handler because that's how you
submit a form. This does not trigger the handler:

document.forms[0].submit();

but you could do this

document.forms[0].submit();
handlerEvent();
prodizy wrote:
Hi,

In Firefox, what's the best way of tracking the form submit?
The following are two ways I tried, but they won't work if the form is
submitted through JavaScript.

Method 1: using the window.onsubmit event handler

Code: window.onsubmit =handleEvent;

Method 2: I am attachin event listeners to all the forms for the event
submit.

Code:

for(var i=0;i<forms.len gth;i++)
{
var form=forms[i];
form.addEventLi stener("submit" ,handleEvent,fa lse);
}

It seems submit event is not generated if the form doesn't have a
submit button. Why so?

What's the best way through which what ever way the form is submitted,
I should be able to track it.

Thanks & Regards,
Rajendra Prasad Murakonda
http://prodizy.livejournal.com/
Aug 31 '06 #2
Benjamin wrote:
Add an event handler to the form tag like this.
<form name="aform" action="a/place.cgi" method="POST"
onsubmit="handl eEvent()">
The submit button triggers the onsubmit handler because that's how you
submit a form. This does not trigger the handler:
document.forms[0].submit();
Why is it like that, any idea?
but you could do this
document.forms[0].submit();
handlerEvent();
I am doing it from my firefox extension, and, not to my own web pages.
So whatever I do, I have to do it using a script. AFAIK, the above is
not possible.

Thanks & Regards,
Rajendra Prasad Murakonda.

Sep 1 '06 #3
prodizy wrote:
Benjamin wrote:
Add an event handler to the form tag like this.
<form name="aform" action="a/place.cgi" method="POST"
onsubmit="handl eEvent()">
The submit button triggers the onsubmit handler because that's how you
submit a form. This does not trigger the handler:
document.forms[0].submit();

Why is it like that, any idea?
but you could do this
document.forms[0].submit();
handlerEvent();

I am doing it from my firefox extension, and, not to my own web pages.
I guess you mean Greasemonkey. :-)
So whatever I do, I have to do it using a script. AFAIK, the above is
not possible.
Add a button to the form (which by default is a submit button) and call
its click method:

var s = document.create Element('button ');
document.someFo rm.appendChild( s);
s.click();
--
Rob

Sep 1 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2557
by: Eric Linders | last post by:
Hello, I have a Web form that is filled out on my company's web site. When the submit button is pressed, the form data is posted to a PHP page that (in the background) inserts their information into a database, sends them a confirmation e-mail, etc. Once the form processing is done, the user is redirected to a Thank You Page. The thank you page has the following code in it:
1
2760
by: marslee | last post by:
I am a php newbie. I would like to count how many times a user visit a webpage. I know session tracking should be used, but where i put the code? Is it inside the html that the user visit? session_start(); if (!IsSet($page_number)) $page_number = 1; print("You have now visited $page_number"); print(" of pages <br />");
6
3670
by: binger | last post by:
Okay, Superbowl is only a few days away, but I thought it would be cool to set up an online registration for a football squares pool. My thoughts are to have people go into anywhere on the 10x10 matrix and put their name in. If someone already has put their name in a square, then the text input box is now static (i.e. cant be overwritten)... Only problem - I'm not sure how to do this. I'd plan on using an
2
342
by: Aadam | last post by:
Does Microsoft have a best practices for tracking errors? (like in a database, what info, etc)
0
1929
by: NB | last post by:
Hi A part of my application involves management of stocks in the warehouse. Incoming/outgoing transactions, stocktake, quantity on hand have all been satisfactorily managed. The app has run robustly for some time. Now I need to develop location tracking functionality.
3
2818
by: Kyle Friesen via AccessMonster.com | last post by:
Mike, I have databse that creates a "tracking number" based on the selections made on the form via concatenating. At the end of the tracking number, I need a two digit (01-99) sequence number by product group for each customer. Hpw do I do this without creating a table for each customer and each product group with autonumbers. For example based on the entries in this sample, the desired result would be: Customer Business Unit Tracking...
1
1471
by: robert.oschler | last post by:
What's a good way to send tracking information to my server when a FORM submission occurs? Right now I build a URL that goes to a server side script that records the information. Then I set an IMG element's SRC attribute to that URL. In Internet Explorer, I do this operation in the form submit handler and in FireFox, in an event listener for the form. In either case when I test it, I see that I'm missing a lot of data. I'm wondering if...
0
2650
by: krishna81m | last post by:
Could some one please explain why the session is not being maintained when I am doing a forward in a servlet after setting a cookie. I am even unable to set session attributes or parameters and do a forward from a servlet to another servlet via a JSP page, the attributes seize to exist. I still do not understand the concept of session tracking. First page JSP: _______________________________________________ <%@ page...
1
2345
by: Acerola | last post by:
I did a quiz, where at the end, the user certifies. It was brought to my attention that after certification, the user could just hit the back button and submit another certification (for example, maybe a co-worker) without going through the quiz. There is no login involved. Is there a way, or, what is the best way to prevent the user from going back? I've tried:
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.