Skip Menu |

This queue is for tickets about the HTML-Form CPAN distribution.

Report information
The Basics
Id: 72925
Status: resolved
Priority: 0/
Queue: HTML-Form

People
Owner: Nobody in particular
Requestors: CHORNY [...] cpan.org
Cc:
AdminCc:

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



Subject: no value for textarea inside label
Value of textarea is not seen when inside label. textarea is an inline tag, so it is valid to have it inside label. <form> <label> <textarea name="tt">test content</textarea> </label> </form> Attaching a test for this bug. P.S. You have no repository for HTML::Form. -- Alexandr Ciornii, http://chorny.net
Subject: form-label.t
#!perl use strict; use warnings; use Test qw(plan ok); plan tests => 2; use HTML::Form; { my $form = HTML::Form->parse(<<"EOT", base => "http://example.com", strict => 1); <form> <label> <input name="tt" type="text" value="test content"> </label> </form> EOT ok($form->param('tt'), 'test content'); } { my $form = HTML::Form->parse(<<"EOT", base => "http://example.com", strict => 1); <form> <label> <textarea name="tt">test content</textarea> </label> </form> EOT ok($form->param('tt'), 'test content'); }
On Sat Dec 03 19:50:34 2011, CHORNY wrote: Show quoted text
> Value of textarea is not seen when inside label. textarea is an inline > tag, so it is valid to have it inside label.
Wrote a patch. Attached. -- Alexandr Ciornii, http://chorny.net
Subject: Form.pm.patch
--- Form.pm.dist 2011-02-27 21:46:36.000000000 +0200 +++ Form.pm 2011-12-04 14:40:26.250000000 +0200 @@ -194,13 +194,15 @@ my($tag, $attr) = @$t; last if $tag eq "/form"; - # if we are inside a label tag, then keep - # appending any text to the current label - if(defined $current_label) { - $current_label = join " ", - grep { defined and length } - $current_label, - $p->get_phrase; + if ($tag ne 'textarea') { + # if we are inside a label tag, then keep + # appending any text to the current label + if(defined $current_label) { + $current_label = join " ", + grep { defined and length } + $current_label, + $p->get_phrase; + } } if ($tag eq "input") {
Thanks. Applied as <https://github.com/gisle/html-form/commit/a1d61e6622057f9faa73d7a3eb2aab30d70c83f8>. I've also created a separate github repo for html-form. It used to just live as a branch on the libwww-perl repo.