Subject: | Fwd: Creating disabled Textfields? |
Date: | Mon, 31 Jul 2006 18:25:15 -0700 |
To: | bug-HTML-Widget [...] rt.cpan.org |
From: | "Steven Kuo" <attn.steven.kuo [...] gmail.com> |
I'll leave it to you to decide whether this is an
enhancement request or bug. I wanted
to create a disabled Textfield. Although not
documented, this procedure is one that
I thought would work from my brief peek
into the source code -- I tried using
the attributes method in HTML::Widget::Accessor:
$w = HTML::Widget->new;
$w->element(q{Textfield}, q{foo})
->size(20)
->value(20)
->attributes({ disabled => q{disabled}});
print $w->process;
<form action="/" id="widget" method="post"><fieldset><input
class="textfield" disabled="disabled" id="widget_foo" name="foo"
type="text" value="20" /></fieldset></form>
Note, however, that the ->size method call doesn't
work in conjunction with ->attributes.
I ended up using
->attributes(
{ disabled => 'disabled', size => 20 }
)
and
discarding the call to
->size(20)
Other details:
$ perl -v
This is perl, v5.8.7 built for i686-linux
$ uname -a
Linux timbre.nsc.com 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:50:31 EST
2004 i686 athlon i386 GNU/Linux
Version 1.07 of HTML::Widget
--
Regards,
Steven