473,706 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enter key will not submit the form

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 only way I can submit is to
click the submit button. Here is a simplified version of my code that I had
to comment out so you could see the source. Note the name of the page is
Page1.asp

'<%@ Language=VBScri pt %>
'<HTML>
'<HEAD>
'</HEAD>
'<BODY>
'<p>Enter numbers separated by a comma.</p>
'<form action="Page1.a sp" method="POST" id=form1 name=form1>
'<p><input type="text" name="ListID" size="50" maxlength="1000 "></p>
'<p><input type="submit" value="Submit" name="B1"><inpu t type="reset"
value="Reset" 'name="B2"></p>
'</form>
'<%if Request.Form("B 1")="Submit" then
' lvListID=Reques t.Form("ListID" )
' Response.Write lvListID
'End IF '%>
'</BODY>
'</HTML>

I know I've posted a page to itself before and had never had problems with
the Enter key not submitting. What am I doing wrong?
Thanks
Mike
Jul 22 '05 #1
15 6575
It most likely is submitting just fine. You're just not using the correct
criteria to determine if it was submitted. Try either evaluating your IF
statement based on the contents of Request.Form("L istID") or
Request.ServerV ariables("REQUE ST_METHOD"). To verify that your form is
submitting, try using this code and pressing enter:

<HTML>
<HEAD>
</HEAD>
<BODY>
<p>Enter numbers separated by a comma.</p>
<form action="page1.a sp" method="POST" id=form1 name=form1>
<p><input type="text" name="ListID" size="50" maxlength="1000 "></p>
<p><input type="submit" value="Submit" name="B1"><inpu t type="reset"
value="Reset" name="B2"></p>
</form>
<%

For Each thing in Request.Form
Response.Write thing & " = " & Request.Form(th ing) & "<hr />"
Next

%>
</BODY>
</HTML>

Ray at work

"M Smith" <ms****@avma.or g> wrote in message
news:e9******** ******@TK2MSFTN GP12.phx.gbl...
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 only way I can submit is to
click the submit button. Here is a simplified version of my code that I had to comment out so you could see the source. Note the name of the page is
Page1.asp

'<%@ Language=VBScri pt %>
'<HTML>
'<HEAD>
'</HEAD>
'<BODY>
'<p>Enter numbers separated by a comma.</p>
'<form action="Page1.a sp" method="POST" id=form1 name=form1>
'<p><input type="text" name="ListID" size="50" maxlength="1000 "></p>
'<p><input type="submit" value="Submit" name="B1"><inpu t type="reset"
value="Reset" 'name="B2"></p>
'</form>
'<%if Request.Form("B 1")="Submit" then
' lvListID=Reques t.Form("ListID" )
' Response.Write lvListID
'End IF '%>
'</BODY>
'</HTML>

I know I've posted a page to itself before and had never had problems with
the Enter key not submitting. What am I doing wrong?
Thanks
Mike

Jul 22 '05 #2
It's a bug in IE (imagine that). When there is only one text box, IE messes
it up.

I don't remember the work-around (funny that IE is now the browser to work
around), but I think if you add a hidden field, or a text box with the
visibilty hidden it will work.

Bob Lehmann

"M Smith" <ms****@avma.or g> wrote in message
news:e9******** ******@TK2MSFTN GP12.phx.gbl...
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 only way I can submit is to
click the submit button. Here is a simplified version of my code that I had to comment out so you could see the source. Note the name of the page is
Page1.asp

'<%@ Language=VBScri pt %>
'<HTML>
'<HEAD>
'</HEAD>
'<BODY>
'<p>Enter numbers separated by a comma.</p>
'<form action="Page1.a sp" method="POST" id=form1 name=form1>
'<p><input type="text" name="ListID" size="50" maxlength="1000 "></p>
'<p><input type="submit" value="Submit" name="B1"><inpu t type="reset"
value="Reset" 'name="B2"></p>
'</form>
'<%if Request.Form("B 1")="Submit" then
' lvListID=Reques t.Form("ListID" )
' Response.Write lvListID
'End IF '%>
'</BODY>
'</HTML>

I know I've posted a page to itself before and had never had problems with
the Enter key not submitting. What am I doing wrong?
Thanks
Mike

Jul 22 '05 #3
Worked fine for me using IE.

Ray at work

"Bob Lehmann" <no****@dontbot herme.zzz> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
It's a bug in IE (imagine that). When there is only one text box, IE messes it up.

I don't remember the work-around (funny that IE is now the browser to work
around), but I think if you add a hidden field, or a text box with the
visibilty hidden it will work.

Bob Lehmann

Jul 22 '05 #4
M Smith wrote:
...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...

<input type="text" name="ListID" size="50" maxlength="1000 ">
<input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" 'name="B2">


It sounds as if the focus is on the RESET input. Does the behavior change if
you convert the RESET to a button?

<input type="button" value="Reset" onclick="this.f orm.reset()">

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #5
Dave, try it with the code he posted, and you'll see what I'm talking about.

Ray at work

"Dave Anderson" <GT**********@s pammotel.com> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
It sounds as if the focus is on the RESET input. Does the behavior change if you convert the RESET to a button?

<input type="button" value="Reset" onclick="this.f orm.reset()">

Jul 22 '05 #6
Ray Costanzo [MVP] wrote:
Dave, try it with the code he posted, and you'll see what I'm talking
about.


Yeah, you're probably right, Ray.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #7
Maybe the problem is actually that his sound his muted and he's not
hearing the Start Navigation sound. ;]

Ray at work

"Dave Anderson" <GT**********@s pammotel.com> wrote in message
news:Oq******** ******@tk2msftn gp13.phx.gbl...
Ray Costanzo [MVP] wrote:
Dave, try it with the code he posted, and you'll see what I'm talking about.
Yeah, you're probably right, Ray.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per

message. Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your question is worth asking, it's worth posting.

Jul 22 '05 #8
You're right. I was close though.

The bug I was thinking about involved the submit button. When there is a
single textbox, and the "Enter" key is used to submit the form, the onclick
event of the submit button doesn't fire, nor is information about the button
sent to the server.

This discusses the problem in an ASP.Net context, but the same applies to
ASP pages.....
http://www.bbits.co.uk/blog/archive/2004/03/09/191.aspx

Bob Lehmann

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:eS******** ******@tk2msftn gp13.phx.gbl...
Worked fine for me using IE.

Ray at work

"Bob Lehmann" <no****@dontbot herme.zzz> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
It's a bug in IE (imagine that). When there is only one text box, IE

messes
it up.

I don't remember the work-around (funny that IE is now the browser to work around), but I think if you add a hidden field, or a text box with the
visibilty hidden it will work.

Bob Lehmann


Jul 22 '05 #9

"Bob Lehmann" <no****@dontbot herme.zzz> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
You're right. I was close though.

The bug I was thinking about involved the submit button. When there is a single textbox, and the "Enter" key is used to submit the form, the onclick event of the submit button doesn't fire, nor is information about the button sent to the server.
Is that really a bug? I personally would only want an onclick event
to fire on click.

This discusses the problem in an ASP.Net context, but the same applies to ASP pages.....
http://www.bbits.co.uk/blog/archive/2004/03/09/191.aspx


In my opinion, it's a bug in ASP.NET and it's attempt to make a
client-server environment behave like it's not that.

Ray at work

Jul 22 '05 #10

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

Similar topics

2
3192
by: T.E. | last post by:
Hi all, I'm a newbie in php. I encounter a problem with php form that has only one textfield. If I click on the submit button, the form works fine. However, when I press 'enter', the form doesn't work right. After comparing that form with other forms, I noticed the problem
6
3101
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
4
7598
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(){
5
2941
by: Eric | last post by:
Hi All, I'm very experienced in traditional ASP and am new to (am learning) ASP.NET. FYI: I am initially learning ASP.NET with VB.NET to ease the transition for me. I have encountered what I believe to be a huge limitation with ASP.NET and I'm wondering how you have handeled this problem. Let's suppose you have a page where the user can do one of two things: add a "Category", or add a "Movie Title" to an already existing category. ...
6
3739
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many user get used to click "enter" key to submit a form. How can I use "enter" key to submit/postback in ASP.NET. Thank, Guoqi Zheng
6
2504
by: Andrew Willett | last post by:
I have a web form that is a child of a Master Page. It is a login form for forms authentication. When you fill in the username and password box and press ENTER it doesnt process any of the VB.NET code it sits there doing nothing. I've tried some of the solutions on the internet but they don't work - I think it might have something to do with the fact I'm using a Master Page...? PLEASE HELP! This is driving me nuts!!
10
3046
by: Perry van Kuppeveld | last post by:
Hi, I have a problem with formatting a table including text fields wich can contain up to 255 chars. I need a table with 3 columns: - First column 50 % over the with a rowspan of the total number of rows. - Second column 25 %, no rowspan - Third column 25 %, no rowspan
12
6942
by: Daniel Klein | last post by:
I'm pretty new at php and web stuff so please be gentle with me. I'm trying to get a form to submit when the user presses the Enter key. I do not want to use javascript. I've googled this to death and cant find the answer (only hints), except on the 'Experts Exhange' page and you have to pay to get the answer :-( Why is this such a secret in the open source world we live in? Daniel Klein
6
3589
by: Mark B | last post by:
I have a function that looks up a SQL table to see if a search term matches. It works fine but so far there are two things yet to work: 1) After entering a search term and pressing Enter, nothing has been happening. It has only been searching when I click the Search button. 2) Neither of the Response.Write's have been displaying any text. Here's the code:
0
8696
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
9285
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9155
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...
0
8993
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
4448
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4709
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3147
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
2
2500
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2094
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.