[7588] in www-talk@info.cern.ch

home help back first fref pref prev next nref lref last post

Re: Distinguishing between submit buttons

daemon@ATHENA.MIT.EDU (lilley)
Tue Mar 7 13:20:02 1995

Date: Tue, 7 Mar 1995 12:30:24 +0500
Errors-To: procmaster@www19.w3.org
Reply-To: lilley@afs.mcc.ac.uk
From: lilley <lilley@afs.mcc.ac.uk>
To: Multiple recipients of list <www-talk@www10.w3.org>

Rupesh said

> 	Would someone know on how to distinguish between two submit buttons 
> in the same form. In my application, one of them is for "Browse", while 
> the other one is for "Submit". the CGI script has to take different 
> actions for the two. Can't put browse in a separate form as both buttons 
> need some common fields.

Use different name attributes for the two submit buttons:

<input type=submit name="browse" value="Browse...">
<input type=submit name="submit" value="Submit form">

You will get the name=value pair for a named submit button, so you can tell 
which one was pressed.

--
Chris Lilley
+-------------------------------------------------------------------------+
| Technical Author, Manchester and North HPC Training & Education Centre  |
+-------------------------------------------------------------------------+
| Computer Graphics Unit,        |     Email: Chris.Lilley@mcc.ac.uk      |
| Manchester Computing Centre,   |     Voice: +44 61 275 6045             |
| Oxford Road,                   |       Fax: +44 61 275 6040             |
| Manchester, UK.  M13 9PL       |      X400: /I=c /S=lilley              |
|                 /O=manchester-computing-centre /PRMD=UK.AC /ADMD= /C=GB/|
|<A HREF="http://info.mcc.ac.uk/CGU/staff/lilley/lilley.html">my page</A> | 
+-------------------------------------------------------------------------+
|This is supposed to be data transfer, not artificial intelligence. M VanH|
+-------------------------------------------------------------------------+

home help back first fref pref prev next nref lref last post