473,473 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

When Is OnSubmit Executed???

Hi All,

I'm trying to create a text field that, when two or more characters
are entered, the form is automatically submitted. The trouble I'm
having is knowing when the onSubmit handler is fired. It's supposed
to be executed when the form is submitted. I'm doing a submit via JS
which should cause the form to run the onSubmit handler. But, it
isn't. This leads me to believe that calling submit() is different
from a hard submit. True?
<SCRIPT language="Javascript1.2">
function submitLetters(form, control)
{
var returnValue = true;
if (event.keyCode == 13)
returnValue = false;
else
form.submit();
return returnValue;
}

function CheckFilter(form)
{
var returnValue = true;
alert("length: " + form.nTypeFilter.value.length);
if (form.nTypeFilter.value.length < 2)
returnValue = false;
return returnValue;
}
</SCRIPT>

<FORM name="ByLastName" method="post" onSubmit="return
CheckFilter(this);">
<INPUT type="text" name="nTypeFilter" value="" onKeyPress="return
submitLetters(ByLastName, this);">
</FORM>
Jul 23 '05 #1
1 1928
Robert Nurse wrote:
I'm trying to create a text field that, when two or more characters
are entered, the form is automatically submitted. The trouble I'm
having is knowing when the onSubmit handler is fired.
When the user submits the form
I'm doing a submit via JS which should cause the form to run the onSubmit
handler. But, it isn't. This leads me to believe that calling submit()
is different from a hard submit. True?


Yes. Submissions by JS don't trigger the onsubmit event.
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2

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

Similar topics

3
by: jeff | last post by:
Hello, I have a form that submits it's values to a pop-up window. I've simplied the code: <form name="formname" action="action.php" target="windowName" method="post" onsubmit="window.open('',...
2
by: OtisUsenet | last post by:
Hello, I am trying to call Javascript from FORM's onSubmit, and return false, so the form is not actually submitted. Normally I can just add 'return false;' to onSubmit to accomplish this, like...
4
by: usl2222 | last post by:
Hi folks, I appreciate any assistance in the following problem: I have a form with a bunch of dynamic controls on it. All the controls are dynamically generated on a server, including all...
4
by: Tina | last post by:
I have some javascript that I want executed whenever my form is subitted so I put onSubmit= "return myfunction();" in my <form clause on my aspx page. If the user hits a button the javascript...
3
by: Taras_96 | last post by:
Hi everyone, I've got a rather unconventional architecture that I'm having problems with... I have a form called "searchForm", that has an input of type "submit" (with name = "submitButton...
5
by: Water Cooler v2 | last post by:
When does the onSubmit event occur? When does the JavaScript code we write in this event get executed? a. Before a page is posted to the server? b. After the page is posted back, if posted back...
3
by: Steve Brecher | last post by:
I have some code comprising the onsubmit attrribute of a form. The code is executing, but apparently a function called as the last statement is not executed. The form content is submitted to the...
2
by: jimfromsd | last post by:
I have a particular problem where I need to have one form perform two actions. Can you just have 2 actions in the action parameter ("action = ....blahblah.asp, ...yaddayadda.jsp") or is there some...
2
by: Sorrow | last post by:
If you have an onsubmit event handler defined for a form, it doesn't seem to trigger if you manually call the .submit() method of the form object. Is there any way you can make sure that code is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.