473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Anyone know why this is happening?

This is more of an HTML question, but it's related to a PHP project.

I have a simple form consisting of 2 selects, 1 text input and a submit
button. The form action submits to the same page.

When entering a string into the text input and hitting return (without
tabbing to and clicking "Submit") the page reloads, but no results appear.
However tabbing to or clicking "Submit" work as expected.

On the server side $_POST['Submit'] exists when tabbing to or clicking
"Submit", but doesn't when hitting return from the text input.

Can someone tell me why this is happening?

Thanks!
Jul 17 '05 #1
4 1670
Bosconian <bo*******@planetx.com> wrote:
When entering a string into the text input and hitting return (without
tabbing to and clicking "Submit") the page reloads, but no results appear.
However tabbing to or clicking "Submit" work as expected.

On the server side $_POST['Submit'] exists when tabbing to or clicking
"Submit", but doesn't when hitting return from the text input.

Can someone tell me why this is happening?


-Hitting enter in a form with 1 text input firing a submit event is by
design.
-Not getting results sounds like a logic error in your code... now you know
this can happen, you know not to depend on an index in _POST called
'Submit'.

--

Daniel Tryba

Jul 17 '05 #2
Dan,

Thanks for your reply.

I have changed my logic to look for one of the form fields instead of
"Submit". I'd still like to know why a submit input when given a name (i.e.
"Submit") doesn't pass when pressing enter on another form field.

"Daniel Tryba" <ne****************@canopus.nl> wrote in message
news:cj**********@news.tue.nl...
Bosconian <bo*******@planetx.com> wrote:
When entering a string into the text input and hitting return (without
tabbing to and clicking "Submit") the page reloads, but no results appear. However tabbing to or clicking "Submit" work as expected.

On the server side $_POST['Submit'] exists when tabbing to or clicking
"Submit", but doesn't when hitting return from the text input.

Can someone tell me why this is happening?
-Hitting enter in a form with 1 text input firing a submit event is by
design.
-Not getting results sounds like a logic error in your code... now you

know this can happen, you know not to depend on an index in _POST called
'Submit'.

--

Daniel Tryba

Jul 17 '05 #3
Bosconian <bo*******@planetx.com> wrote:
Dan,

Thanks for your reply.

I have changed my logic to look for one of the form fields instead of
"Submit". I'd still like to know why a submit input when given a name (i.e.
"Submit") doesn't pass when pressing enter on another form field.

"Daniel Tryba" <ne****************@canopus.nl> wrote in message
news:cj**********@news.tue.nl...
Bosconian <bo*******@planetx.com> wrote:
When entering a string into the text input and hitting return (without
tabbing to and clicking "Submit") the page reloads, but no results appear. However tabbing to or clicking "Submit" work as expected.

On the server side $_POST['Submit'] exists when tabbing to or clicking
"Submit", but doesn't when hitting return from the text input.

Can someone tell me why this is happening?


-Hitting enter in a form with 1 text input firing a submit event is by
design.
-Not getting results sounds like a logic error in your code... now you

know
this can happen, you know not to depend on an index in _POST called
'Submit'.

--

Daniel Tryba


Submit-fields are only submitted in case the user clicked on them to submit
the form. Otherwise, the name-attribute would be senseless for them because
you could use hidden to archive that goal, too.
Btw: This behaviour is often used in applications, for example all bulletin
boards written in PHP I know offer an optional preview of the posting which
is about to be published. This is determined by specifiing two submit
buttons with different names and checking, which one has been used to
submit the form.
If -on the other hand- a submit button would *always* be transmitted, you
would always get both buttons and therefore be unable to determine, which
one the user clicked.
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #4
Simon,

Thanks for the clarification. I have used multiple submit buttons in a form
before for the purpose you described, but for some reason the behavior in
question was never obvious to me until now.

Regards,

"Simon Stienen" <si***********@news.slashlife.de> wrote in message
news:yw***************@news.dangerouscat.net...
Bosconian <bo*******@planetx.com> wrote:
Dan,

Thanks for your reply.

I have changed my logic to look for one of the form fields instead of
"Submit". I'd still like to know why a submit input when given a name (i.e. "Submit") doesn't pass when pressing enter on another form field.

"Daniel Tryba" <ne****************@canopus.nl> wrote in message
news:cj**********@news.tue.nl...
Bosconian <bo*******@planetx.com> wrote:
When entering a string into the text input and hitting return (without
tabbing to and clicking "Submit") the page reloads, but no results appear.
However tabbing to or clicking "Submit" work as expected.

On the server side $_POST['Submit'] exists when tabbing to or clicking
"Submit", but doesn't when hitting return from the text input.

Can someone tell me why this is happening?

-Hitting enter in a form with 1 text input firing a submit event is by
design.
-Not getting results sounds like a logic error in your code... now you

know
this can happen, you know not to depend on an index in _POST called
'Submit'.

--

Daniel Tryba


Submit-fields are only submitted in case the user clicked on them to

submit the form. Otherwise, the name-attribute would be senseless for them because you could use hidden to archive that goal, too.
Btw: This behaviour is often used in applications, for example all bulletin boards written in PHP I know offer an optional preview of the posting which is about to be published. This is determined by specifiing two submit
buttons with different names and checking, which one has been used to
submit the form.
If -on the other hand- a submit button would *always* be transmitted, you
would always get both buttons and therefore be unable to determine, which
one the user clicked.
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle

Jul 17 '05 #5

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

Similar topics

8
by: Auric__ | last post by:
I need to copy some Unicode text to the Clipboard, but it ain't happening. :/ If there's no equivalent in VB, what's the API call? -- auric "underscore" "underscore" "at" hotmail "dot" com...
4
by: Lol McBride | last post by:
Hi all, I'm developing an OOP program and trying to be smart by using unittest to help me to catch as many bugs as possible during development.Unfortunately I've hit a snag which I believe is to...
15
by: Brandon J. Van Every | last post by:
Is anyone using Python for .NET? I mean Brian's version at Zope, which simply accesses .NET in a one-way fashion from Python. http://www.zope.org/Members/Brian/PythonNet Not the experimental...
1
by: Fancy Pants | last post by:
Hi everyone, Just wanted to post this on here to see what you all could come up with. I am creating a Font Sizer and it has to be compatible with NN4+,IE4+,Mozilla, And Opera. I have it...
9
by: MLH | last post by:
Trouble is, it doesn't happen every time. Yesterday, for example, it happened only once and not again afterward. Some days ago, a similar situation. Today, well - I tried 7 times straight to open...
6
by: Andrew Mueller | last post by:
Hello all, There is a message below 'Application Error... When querying data'. What appears to be happening is that when I perform a lot of queries in a row and bring back the information into...
4
by: Ersin Gençtürk | last post by:
Server : WEB System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Web.HttpException: The View State is invalid for this page and might be...
33
by: O-('' Q) | last post by:
....to translate the following to C#.NET style? var i: Integer; begin txtMyIP.Lines.Clear; sHTML := HTTP.Get('http://www.network-tools.com/'); if sHTML = '' then Exit; sIpAddr := 'IP...
11
by: Ken Fine | last post by:
I am using VS.NET 2008 and like it a lot. One of the very few things I don't like is a bug that seems to spawn literally thousands of   strings, one after the other, on design view changes....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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,...

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.