|
Posted by JDS on 04/17/06 21:49
On Mon, 17 Apr 2006 11:05:30 -0700, nettleby@googlemail.com wrote:
> In practice, when the submit button is clicked, then there is no data
> transmitted for the button, obviously, as there is no name. When the
> reset button is clicked, then the appropriate name/value pair is
> transmitted. I would have thought this meant the server end could
> differentiate between the two buttons, as long as it's aware of the
> design of the page? (Leaving aside the complications of the Enter key
> being pressed.)
Hi.
You can do it one of two ways:
(1) Unique button names
or
(2) unique button values
or
(3) both
The way Jonathan N Little suggested was with unique button names.
Personally, I don't see the point, and I think using method (2) makes it
harder to code stuff on the server. If you have two submit buttons, it
doesn't matter what they are named (named the same or differently), the
server only ever sees the buton that was pressed. It is as simple as that.
HOWEVER, in answer to (one of) your question(s), "no". You *MUST* have a
name for the button for the server to know what it is.
Additionally, the server has absolutely no idea about the "design of the
page". Not sure what you mean by that.
It works like this:
(1) There is an HTML form
(2) The Web server gets some data passed to it from the form in a specific
format.
(3) a "script" or program of some kind gets the information sent to it in
roughly the same format, and then does "something" with the data.
The server and the script on the server don't know *ANYTHING* at all about
the HTML page. All they see, in a vacuum, is some specifically-formatted
data. Because of this vacuum, you must make sure that your HTML form is
set up properly to send all of the data that the server is going to need.
And this proper set up includes giving your submit button(s) a name.
Still stuck? Please ask more.
later...
--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
Navigation:
[Reply to this message]
|