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

Home Posts Topics Members FAQ

Stopping auto submit...

This one has me perplexed

from vs.net web app

add a new aspx pag
add 3 textbox's and a command butto
in the command buttons click event add response.write "button1 click

from any textbox press the enter ke
the Button1 Click event fire

add a new button, do nothing else except add respnse.write "buttonX click
it's click event might fire but it might be button1.. no real differences to the buttons properties but for some reason (that I can identify)

If anything I would prefer the Enter key to act as a tab key, the only cure I have found is to make the textbox a multiLine textbox. However, I would prefer not to do this, but I can't have someone submitting the form before all the textbox's have entrys (yes I know about fieldvalidators, I would just prefer not to have the it happen and or to have the page do something else

Thanks

Ro
Nov 18 '05 #1
5 1983
Hi Rob,

I'm wondering if you're describing the bug discussed in this article?

http://support.microsoft.com/?kbid=813822

"Rob Lynch" <an*******@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
This one has me perplexed.

from vs.net web app.

add a new aspx page
add 3 textbox's and a command button
in the command buttons click event add response.write "button1 click"

from any textbox press the enter key
the Button1 Click event fires

add a new button, do nothing else except add respnse.write "buttonX click"
it's click event might fire but it might be button1.. no real differences
to the buttons properties but for some reason (that I can identify)

If anything I would prefer the Enter key to act as a tab key, the only
cure I have found is to make the textbox a multiLine textbox. However, I
would prefer not to do this, but I can't have someone submitting the form
before all the textbox's have entrys (yes I know about fieldvalidators, I
would just prefer not to have the it happen and or to have the page do
something else.

Thanks

Rob


Nov 18 '05 #2
Add this event to your text boxes onkeydown="javascript:testForEnter()"

add add this to your page.

<SCRIPT LANGUAGE="javascript">
function testForEnter()
{
if (event.keyCode == 13)
{
event.cancelBubble = true;
event.returnValue = false;
}
}
</SCRIPT>

"Rob Lynch" <an*******@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
This one has me perplexed.

from vs.net web app.

add a new aspx page
add 3 textbox's and a command button
in the command buttons click event add response.write "button1 click"

from any textbox press the enter key
the Button1 Click event fires

add a new button, do nothing else except add respnse.write "buttonX click"
it's click event might fire but it might be button1.. no real differences to the buttons properties but for some reason (that I can identify)
If anything I would prefer the Enter key to act as a tab key, the only cure I have found is to make the textbox a multiLine textbox. However, I
would prefer not to do this, but I can't have someone submitting the form
before all the textbox's have entrys (yes I know about fieldvalidators, I
would just prefer not to have the it happen and or to have the page do
something else.
Thanks

Rob

Nov 18 '05 #3
Ken

It sure sounds like exactly the same behavour that I have been seeing. It seems like the solution being proposed requires the use of fieldvalidators... There are a couple of fileds that are OK if they are blank, but I still don't want the enter to do the autosubmit

I am going with a combo of what vMike suggests (was doing something ike that and a programatic autotab - for the textbox's that are singleline..

Of course just squeltching the enter via event.returnvalue = false or multiline would be ok, I have decided I will also go the extra 1inch and add an auto tab

Thanks for the effort. I think you found the problem I was seeing

Ro

PS Was my other address a good one?
Nov 18 '05 #4
What I ended up with (and it seems to work quite well) - Thanks All

Code Behind Pag

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loa
'Put user code to initialize the page her
TextBox1.Attributes.Add("onkeypress", "setEnterKey('TextBox1');"
TextBox2.Attributes.Add("onkeypress", "setEnterKey('TextBox2');"
End Su

Web Pag

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="MailTo.aspx.vb" Inherits="XXXXXXX.MailTo"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><script language="JavaScript"><!-

function setEnterKey(btnName)
if (event.keyCode == 13)
event.cancelBubble = true

if (btnName=="TextBox1")
eval('this.Form1.TextBox2.focus()')

else if (btnName == "TextBox2")
eval('this.Form1.Button1.focus()')

event.returnValue = false

}
//--></script></HEAD><body><form id="Form1" method="post" runat="server"><asp:TextBox id="TextBox1" runat="server"></asp:TextBox><asp:TextBox id="TextBox2" runat="server"></asp:TextBox><asp:Button id="Button1" runat="server" Text="Button"></asp:Button></form></body></HTML>
Nov 18 '05 #5
Hi Rob,
PS Was my other address a good one?


Sorry, no idea. MVPs don't have anything to do with Microsoft's MSDN Managed
Support service except that some of us are also signed up for it as
customers.

Ken

Nov 18 '05 #6

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

Similar topics

4
by: Scott Castillo | last post by:
Does anybody know how to auto-submit a form in PHP without Javascript? For instance, submit form variables to self, validate the data in PHP on same page, then, if no errors, auto-submit the data...
5
by: Batezz | last post by:
I have created a form (below) How do I stop it redirecting to another page (productsearchresults.php) when form is submitted if both the fields are blank? Any help appreciated. Batezz
8
by: Prometheus Research | last post by:
http://newyork.craigslist.org/eng/34043771.html We need a JavaScript component which will auto-submit a form after a set period has elapsed. The component must display a counter that dynamically...
5
by: Navillus | last post by:
Hey gang, I have a login form that is empty by default, but can be filled with values from a previous form: <input type=text maxlength="40" size="40" name="user" value="`usr`"> <input...
5
by: Phil Latio | last post by:
I have 2 virtually identical tables and wish to move data between them. Basically one table is called "live_table" and the other is named "suspended_table" and the only difference is that the...
0
by: Boki | last post by:
Hi All, I am creating a program that performs "auto fill in" and "auto submit" functions. I will feed the webbrowser the target URL, however, I don't know how to auto fill in text and submit....
10
by: laredotornado | last post by:
Hi, I'm using php 5. Does anyone have any code or a function that auto submits a form that contains a single INPUT, of type = file? Thanks, - Dave
9
by: KingKen | last post by:
I am creating an ASP object that will recieve a table, a field for the table and the search text. I already have "edit objects" created for each table in my DB. what i need is a way to submit the...
1
AaronL
by: AaronL | last post by:
Hello, First I would like to say thank you all for your help in the past. I am stumped again. I am creating an e-commerce system and I want to be able to upload images to the server and...
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,...
0
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...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
muto222
php
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.