Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

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=VBScript %>
'<HTML>
'<HEAD>
'</HEAD>
'<BODY>
'<p>Enter numbers separated by a comma.</p>
'<form action="Page1.asp" 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"><input type="reset"
value="Reset" 'name="B2"></p>
'</form>
'<%if Request.Form("B1")="Submit" then
'   lvListID=Request.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



Report this thread to moderator Post Follow-up to this message
Old Post
M Smith
12-28-04 01:55 AM


Re: Enter key will not submit the form
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("ListID") or
Request.ServerVariables("REQUEST_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.asp" 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"><input type="reset"
value="Reset" name="B2"></p>
</form>
<%

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

%>
</BODY>
</HTML>

Ray at work

"M Smith" <msmith@avma.org> wrote in message
news:e91NCBG7EHA.2180@TK2MSFTNGP12.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=VBScript %>
> '<HTML>
> '<HEAD>
> '</HEAD>
> '<BODY>
> '<p>Enter numbers separated by a comma.</p>
> '<form action="Page1.asp" 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"><input type="reset"
> value="Reset" 'name="B2"></p>
> '</form>
> '<%if Request.Form("B1")="Submit" then
> '   lvListID=Request.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
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Ray Costanzo [MVP]
12-28-04 01:55 AM


Re: Enter key will not submit the form
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" <msmith@avma.org> wrote in message
news:e91NCBG7EHA.2180@TK2MSFTNGP12.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=VBScript %>
> '<HTML>
> '<HEAD>
> '</HEAD>
> '<BODY>
> '<p>Enter numbers separated by a comma.</p>
> '<form action="Page1.asp" 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"><input type="reset"
> value="Reset" 'name="B2"></p>
> '</form>
> '<%if Request.Form("B1")="Submit" then
> '   lvListID=Request.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
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Bob Lehmann
12-28-04 01:55 AM


Re: Enter key will not submit the form
Worked fine for me using IE.

Ray at work

"Bob Lehmann" <nospam@dontbotherme.zzz> wrote in message
news:%23P7dCFH7EHA.4028@TK2MSFTNGP15.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



Report this thread to moderator Post Follow-up to this message
Old Post
Ray Costanzo [MVP]
12-28-04 08:55 PM


Re: Enter key will not submit the form
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.form.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.



Report this thread to moderator Post Follow-up to this message
Old Post
Dave Anderson
12-28-04 08:55 PM


Re: Enter key will not submit the form
Dave, try it with the code he posted, and you'll see what I'm talking about.

Ray at work

"Dave Anderson" <GTSPXOESSGOQ@spammotel.com> wrote in message
news:uCovTxO7EHA.2600@TK2MSFTNGP09.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.form.reset()">
>



Report this thread to moderator Post Follow-up to this message
Old Post
Ray Costanzo [MVP]
12-28-04 08:55 PM


Re: Enter key will not submit the form
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.



Report this thread to moderator Post Follow-up to this message
Old Post
Dave Anderson
12-28-04 08:55 PM


Re: Enter key will not submit the form
Maybe the problem is actually that his sound his muted and he's not
hearing the Start Navigation sound.  ;]

Ray at work

"Dave Anderson" <GTSPXOESSGOQ@spammotel.com> wrote in message
news:OqHR6$O7EHA.3836@tk2msftngp13.phx.gbl...
> Ray Costanzo [MVP] wrote: 
talking 
>
> 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.
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Ray Costanzo [MVP]
12-28-04 08:55 PM


Re: Enter key will not submit the form
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:eS5QJPO7EHA.1596@tk2msftngp13.phx.gbl...
> Worked fine for me using IE.
>
> Ray at work
>
> "Bob Lehmann" <nospam@dontbotherme.zzz> wrote in message
> news:%23P7dCFH7EHA.4028@TK2MSFTNGP15.phx.gbl... 
> messes 
work 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Bob Lehmann
12-28-04 08:55 PM


Re: Enter key will not submit the form
"Bob Lehmann" <nospam@dontbotherme.zzz> wrote in message
news:%23Fksd%23P7EHA.3336@TK2MSFTNGP11.phx.gbl...
> 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




Report this thread to moderator Post Follow-up to this message
Old Post
Ray Costanzo [MVP]
12-28-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

ASP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:24 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.