Subject: | Add support for ID attribute on form tags (name attribute is deprecated in xhtml) |
Add support for <form id="foo"> so we can pass W3C xhtml validation, as
<form name="foo"> is deprecated.
Subject: | html-fill-in.patch |
Only in HTML-FillInForm-1.06-new/: Makefile.old
diff -ur HTML-FillInForm-1.06/lib/HTML/FillInForm.pm HTML-FillInForm-1.06-new/lib/HTML/FillInForm.pm
--- HTML-FillInForm-1.06/lib/HTML/FillInForm.pm 2005-10-13 13:49:09.000000000 -0700
+++ HTML-FillInForm-1.06-new/lib/HTML/FillInForm.pm 2007-06-01 12:19:16.000000000 -0700
@@ -99,8 +99,8 @@
# set the current form
if ($tagname eq 'form') {
$self->{object_param_cache} = {};
- if (exists $attr->{'name'}) {
- $self->{'current_form'} = $attr->{'name'};
+ if (exists $attr->{'name'} || exists $attr->{'id'}) {
+ $self->{'current_form'} = $attr->{'name'} || $attr->{'id'};
} else {
# in case of previous one without </FORM>
delete $self->{'current_form'};
diff -ur HTML-FillInForm-1.06/t/11_target.t HTML-FillInForm-1.06-new/t/11_target.t
--- HTML-FillInForm-1.06/t/11_target.t 2002-08-29 14:53:37.000000000 -0700
+++ HTML-FillInForm-1.06-new/t/11_target.t 2007-06-01 12:33:19.000000000 -0700
@@ -2,7 +2,7 @@
use strict;
use Test;
-BEGIN { plan tests => 3 }
+BEGIN { plan tests => 8 }
use HTML::FillInForm;
@@ -16,6 +16,9 @@
<FORM>
<INPUT TYPE="TEXT" NAME="foo3" value="nada">
</FORM>
+<FORM id="foo4">
+<INPUT TYPE="TEXT" NAME="foo4" value="nada">
+</FORM>
EOF
;
@@ -23,6 +26,7 @@
foo1 => 'bar1',
foo2 => 'bar2',
foo3 => 'bar3',
+ foo4 => 'bar4',
);
my $fif = new HTML::FillInForm;
@@ -36,3 +40,16 @@
ok($v[0], 'nada');
ok($v[1], 'bar2');
ok($v[2], 'nada');
+ok($v[3], 'nada');
+
+my $output2 = $fif->fill(
+ scalarref => \$form,
+ fdat => \%fdat,
+ target => 'foo4',
+);
+
+my @v2 = $output2 =~ m/<input .*?value="(.*?)"/ig;
+ok($v2[0], 'nada');
+ok($v2[1], 'nada');
+ok($v2[2], 'nada');
+ok($v2[3], 'bar4');