W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > October to December 2004

Re: button tag

From: Matthew Smith <matt@kbc.net.au>
Date: Tue, 30 Nov 2004 07:25:21 +1030
Message-ID: <41AB8CB9.2090402@kbc.net.au>
To: Luis Fernando Llana Díaz <llana@sip.ucm.es>
CC: w3c-wai-ig@w3.org

Luis Fernando Llana Díaz wrote:
>   I have to make a form where some input controls should send
> the form when their contents is changed. It is easely done with 
> javascript, but in orden to make it accesible I am considering to
> attach a button to each of these "auto-submuit" input controls.
(message clipped here)
> Pleas, could anyone indicate me what is the correct interpretation.

I have come across a similar problem before, having a form with several submit 
buttons, each performing a different action.

I assume that you want to use type=button rather than type=submit because a 
value in a submit button which makes sense to a user is not a good input value 
for the processing software.

My solution was to substitute an appropriate value in the processing software.

Form Example:

<form method="get" action="http://www.foo.com/bar/baz.cgi">
<fieldset><legend>Actions (Selecting will submit form)</legend>
<input type="submit" name="action" value="First Button" />
<input type="submit" name="action" value="Second Button" />
<input type="submit" name="action" value="Third Button" />

Code example, in Perl, using CGI module for simplicity.  (I don't know PHP, but 
assume that it must have regular expressions.)

# Initialise CGI module
use CGI;
my $q=new CGI;

# Set variable $action to be the value of the submit button selected
my $action=$q->param('action');

# Use regular expressions to substitute a "sensible" value
# so that "First Button" becomes "1", etc.
$action=~s/First Button/1/;
$action=~s/Second Button/2/;
$action=~s/Third Button/3/;

Hope this helps.



Matthew Smith
Kadina Business Consultancy
South Australia
Received on Monday, 29 November 2004 20:55:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 13 October 2015 16:21:30 UTC