Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 12408
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: LDS [...] cpan.org
Requestors: xavier.Lagraula [...] free.fr
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: CGI::button and CGI::start_button unfortunate inconsistency
Download (untitled) / with headers
text/plain 3.1k
Hello. (Note: technical environment information is probably irrelevant, but included at the end nontheless) I have found an unfortunate inconsistency between the "CGI::button()" method and the (auto-generated) "CGI::start/end_button()" methods in CGI.pm, when trying to achieve this: <button type="submit" name="action">label</button> (cf. http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON ) The only way to do this with the CGI module is to use the "auto generated" "start_button" and "end_button" methods, as both "CGI::submit" and "CGI::button" generate an <input...> item. knowing that "CGI::input({-type=>'button'})" can be used to achieve the same result as "CGI::button()", it would seem logical to me to modify "CGI:button()" to eliminate the inconsistency and at the same time add a feature to CGI.pm. In other words, because " use CGI qw/:any/ ; my $cgi = new CGI ; print $cgi->start_button({ -name => 'action', -value => 'newInfo' }) ; print 'Create new information' ; print $cgi->end_button() ; " generates " <button name="action" value="newInfo">Create new information</button> ", I would expect " use CGI ; my $cgi = new CGI ; print $cgi->button( { -name => 'action', -value => 'newInfo' }, 'Create new information' ) ; " to do exactly the same thing. This is in no way more difficult than the way "table", "td", and such tags are handled. I understand, though, that modifying the semantics of the "button" method would break many scripts. So I suggest that "start_button" and "end_button" be modified to match the current "button" method (consistency), and that a new method name be chosen to generate <button></button> HTML tags (completeness). WHY do I request this / HOW did I find the issue: I have a nice CGI script here, written using the CGI module without a trace of hard coded HTML code in it (which is The Best Way(tm) in the context I'm working here - doing so reduced the size of the original script by 40% while improving it maintenability). My problem is that I would like to create submit buttons for a form using three different values for -1- the button name, -2- the button value and -3- the button label. The reason is simple: I have several submit buttons, that I would like to be all mapped to the "action" parameter of my script. I would also like the different actions to be mapped to "simple to parse" values ("record", "delete", "newItem", and the like). And last but not least I would like to have informative labels, with spaces in them, etc. As you can see, nothing extraordinary. The "CGI::submit" method generates an [input type="submit"] item for which the label can only be the content of the "value" attribute (or the "name" if there is no "value"). The "CGI::button" method generates an [input type="button"] item which suffers from the same issue (and from being designed for use with javascript, which is not an option here). Technical context (irrelevant): - Module: CGI.pm versions 2.56 (on perl 5.6.0) and 3.07 (on perl 5.8.6) - O.S.: Red Hat Linux 7.2 - $(uname -a): Linux ### 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown - Hardware: old HP server (can't remember the model) Best regards, Xavier Lagraula
Download (untitled) / with headers
text/plain 3.4k
On Mon Apr 25 12:27:20 2005, guest wrote: Show quoted text
> Hello. > > (Note: technical environment information is probably irrelevant, but > included at the end nontheless) > > I have found an unfortunate inconsistency between the "CGI::button()" > method and the (auto-generated) "CGI::start/end_button()" methods > in CGI.pm, when trying to achieve this: > <button type="submit" name="action">label</button> > (cf. http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON ) > > The only way to do this with the CGI module is to use the "auto > generated" "start_button" and "end_button" methods, as both > "CGI::submit" and "CGI::button" generate an <input...> item. > knowing that "CGI::input({-type=>'button'})" can be used to
achieve Show quoted text
> the same result as "CGI::button()", it would seem logical to me to > modify "CGI:button()" to eliminate the inconsistency and at the > same time add a feature to CGI.pm. > > In other words, because " > > use CGI qw/:any/ ; > my $cgi = new CGI ; > print $cgi->start_button({ -name => 'action', -value
=> 'newInfo' }) ; Show quoted text
> print 'Create new information' ; > print $cgi->end_button() ; > > " generates " > > <button name="action" value="newInfo">Create new information</button> > > ", I would expect " > > use CGI ; > my $cgi = new CGI ; > print $cgi->button( > { -name => 'action', -value => 'newInfo' }, > 'Create new information' > ) ; > > " to do exactly the same thing. > > This is in no way more difficult than the way "table", "td", and such > tags are handled. > > I understand, though, that modifying the semantics of the "button" > method would break many scripts. So I suggest that "start_button" > and "end_button" be modified to match the current "button" method > (consistency), and that a new method name be chosen to generate > <button></button> HTML tags (completeness). > > WHY do I request this / HOW did I find the issue: > > I have a nice CGI script here, written using the CGI module without a > trace of hard coded HTML code in it (which is The Best Way(tm) in > the context I'm working here - doing so reduced the size of the > original script by 40% while improving it maintenability). My > problem is that I would like to create submit buttons for a form > using three different values for -1- the button name, -2- the > button value and -3- the button label. The reason is simple: I
have Show quoted text
> several submit buttons, that I would like to be all mapped to the > "action" parameter of my script. I would also like the different > actions to be mapped to "simple to parse" values ("record", > "delete", "newItem", and the like). And last but not least I would > like to have informative labels, with spaces in them, etc. As you > can see, nothing extraordinary. > > The "CGI::submit" method generates an [input type="submit"] item for > which the label can only be the content of the "value" attribute > (or the "name" if there is no "value"). > The "CGI::button" method generates an [input type="button"] item
which Show quoted text
> suffers from the same issue (and from being designed for use with > javascript, which is not an option here). > > Technical context (irrelevant): > - Module: CGI.pm versions 2.56 (on perl 5.6.0) and 3.07 (on perl > 5.8.6) > - O.S.: Red Hat Linux 7.2 > - $(uname -a): Linux ### 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 > i686 unknown > - Hardware: old HP server (can't remember the model) > > Best regards, > Xavier Lagraula
Download (untitled) / with headers
text/plain 308b
You can achieve the effect that you want like this: use CGI 'Button'; my $cgi = new CGI ; print $cgi->Button( { -name => 'action', -value => 'newInfo' }, 'Create new information' ) ; which produces this output: <button name="action" value="newInfo">Create new information</button>
Subject: car insurance<a href='http://www.insurance-top.com'
From: http://www.insurance-top.com
Download (untitled) / with headers
text/plain 376b
<a href='http://www.yahoo.com'></a>Thanks! http://www.insurance-top.com/auto/ <a href='http://www.insurance-top.com'>auto insurance</a>. <a href="http://www.insurance-top.com ">Insurance car</a>: auto insurance, insurance car, Best Insurance Web site . Also [url]http://www.insurance-top.com/car/[/url] and [link=http://www.insurance-top.com]insurance quote[/link] from site .
Subject: insurance auto<a href='http://www.insurance-top.com'
From: http://www.insurance-top.com
Download (untitled) / with headers
text/plain 256b
Thanks!!! http://www.insurance-top.com/company/ auto site insurance. [URL=http://www.insurance-top.com]home insurance[/URL]: auto insurance, insurance car, Best Insurance Web site . Also [url=http://www.insurance-top.com]cars insurance[/url] from website .
Subject: insurance auto<a href='http://www.insurance-top.com'
From: http://www.insurance-top.com
Download (untitled) / with headers
text/plain 134b
Hi! http://www.insurance-top.com/company/ auto site insurance. auto insurance, insurance car, Best Insurance Web site . from website .
Subject: <a href='gle.com'
From: gle.com
Subject: <a href='#'
From: #


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.