View Full Version : can I tell whether a form is being submitted

10-12-2011, 04:31 AM
Hi all!

I have a form called "theForm". How can I tell if the user has submitted the form or hit the submit button??

Is it..


do something



Old Pedant
10-12-2011, 04:58 AM
<form action="xxxx.yyy" method="post" onsubmit="alert('call any function here'); return true;">

If you want to validate the form, at the same time, do something like

<form action="xxxx.yyy" method="post" onsubmit="return validateForm(this);">

and have validateForm return true if no errors or false for one or more errors.

10-12-2011, 12:55 PM
You may do it dynamically, as well:

var form=document.forms['theForm'];
// do something

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum