473,569 Members | 2,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to submit a form when enter is pressed

RTT
<form id="Form1" method="post" runat="server">
<asp:textbox id="TxtEmail" tabIndex="1" runat="server" Width="272px"
ToolTip="Enter your emailaddress for authentication" ></asp:textbox>
<asp:textbox id="TxtPassword " tabIndex="2" runat="server" Width="272px"
ToolTip="Enter your domain password" TextMode="Passw ord"></asp:textbox>
<asp:linkbutt on id="BtnLogin" tabIndex="3"
runat="server"> Login</asp:linkbutton>
</form>

This is the form as i use it for my user to enter thier login information.
But now they have to click the link in order to log in. Is it possible to
submit the form when 'enter' is pressed (like it's the case with input
type="submit" in standard html forms).

does anyone know how to do this?
Nov 21 '05 #1
2 3558
Hi,

You can use the following code for it:

<input type="submit" style="display: none;">

Also, you can use the foolowing method:

In your HTML code,

<script language="javas cript">
function blockEnter(evt)
{

if (evt.keyCode == 13)
{

if (evt.srcElement .tagName=="TEXT AREA")
return true;
return false;
}
}

</script>

In the page's codebehind, add this code to the page's prerender event:

TextBox1.Attrib utes.Add("onKey Down", "return blockEnter(even t)")

HTH

Mona[Grapecity]


"RTT" <RT*@pandora.be > wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
<form id="Form1" method="post" runat="server">
<asp:textbox id="TxtEmail" tabIndex="1" runat="server" Width="272px"
ToolTip="Enter your emailaddress for authentication" ></asp:textbox>
<asp:textbox id="TxtPassword " tabIndex="2" runat="server" Width="272px"
ToolTip="Enter your domain password" TextMode="Passw ord"></asp:textbox>
<asp:linkbutt on id="BtnLogin" tabIndex="3"
runat="server"> Login</asp:linkbutton>
</form>

This is the form as i use it for my user to enter thier login information.
But now they have to click the link in order to log in. Is it possible to
submit the form when 'enter' is pressed (like it's the case with input
type="submit" in standard html forms).

does anyone know how to do this?

Nov 21 '05 #2
RTT,

Set Form1.AcceptBut ton to the button you want clicket when enter is
pressed.

Nov 21 '05 #3

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

Similar topics

15
6556
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and the buttons. The problem is when I post a form to itself, the Enter key will not submit the form, it only clears the contents of the text box. The...
6
3089
by: CJM | last post by:
Can somebody clarify if/how/when a simple form is submitted when the <Enter> key is pressed? As I understood it, if you have a form with a single submit button, if enter is pressed, the form should be submitted as if the button is pressed. Is this correct? Does this behaviour vary across browsers? Chris
5
33280
by: http://links.i6networks.com | last post by:
I want to force the users to click submit to submit the forms. How do I disable "Enter Key" which will submit the form automatically when they entered the data in text field then pressed "enter key"
4
7557
by: Peloux | last post by:
Hi, I have written some htc in order to validate data in a form. most of htc are attached on 'onblur' event. Now, we would like to use the Enter Key to sublit form, so we use the following code : ----------- <SCRIPT> function touche_EnterKeyPress(){
11
2136
by: Sandra Castellanos | last post by:
Hello, I want to know what I have to do to make the enter key to submit forms. I read in another newsgroup that inserting an html hidden text box made the trick, and it actually does, but in my page I have more than one web control that have their independient "forms" (in the .NET environment, it makes it to be just one). And I need that,...
5
1920
by: Girish | last post by:
I have TWO submit buttons of type IMAGE on my asp form. This renders as <input type="image">. I need to be able to eble the ENTER button for both buttons. Yes, I know that for the input type image, the submit happens automatically to the server. Heres my problem: I have two event handlers for both these buttons as stated below: BUTTON...
1
2321
by: Alexboy | last post by:
Hello, How do I make ENTER key act as a submit request? As it is now, the user has to actually click "submit" for the form to be submitted (in IE at least). Is there any way to make the enter key submit the form? Example:
24
8399
by: MichaelK | last post by:
Who knows how to prevent submitting a form on the press Enter button before all fields on the form are filled up. People just enter the first field hit Enter and it submits the form and doing validation, of course flushing with the bunch of messages because rest of the fields are empty. I remember I had some pages where wrote the code to go...
9
10645
by: learning | last post by:
Hi! Here's my situation: I have one textfield with one 'submit' button in PAGE1.PHP. When I click on the 'submit' button I am sent to PAGE2.PHP where I have a "switch" routine that checks which 'submit' button was clicked and directs which instructions to do next. My Problem is this: On PAGE1.PHP, there is only one textfield. After...
0
7693
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...
1
7665
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...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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...
0
3651
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
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
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.