It's common to give a form a "name" attribute for use in client-side
scripting. "id" may replace this in HTML4, but plenty of sites out there
will still use "name". Two high profile examples:
The last form on http://www.netscape.com/
The first form on http://www.microsoft.com/

- Mike

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Gisle
> Aas
> Sent: Friday, June 09, 2000 7:43 AM
> To: Edward Jason Riedy
> Cc: [EMAIL PROTECTED]
> Subject: Re: HTML::Form patch, adds name attribute
>
>
> Edward Jason Riedy <[EMAIL PROTECTED]> writes:
>
> > This would be handy to me.  Relying on a particular name is probably
> > about as fragile as relying on the order of forms, but it feels nicer.
>
> But what forms actaully have names?
>
> Looking at the HTML-4 spec it looks like picking up 'id' would make
> more sense.
>
> --Gisle
>
>
> > --- Form.pm.orig    Wed Jun  7 12:33:18 2000
> > +++ Form.pm Wed Jun  7 12:36:54 2000
> > @@ -64,6 +64,7 @@
> >      $self->{method} = uc(shift  || "GET");
> >      $self->{action} = shift  || Carp::croak("No action defined");
> >      $self->{enctype} = shift || "application/x-www-form-urlencoded";
> > +    $self->{name} = shift || undef;
> >      $self->{inputs} = [@_];
> >      $self;
> >  }
> > @@ -94,12 +95,14 @@
> >      while (my $t = $p->get_tag) {
> >     my($tag,$attr) = @$t;
> >     if ($tag eq "form") {
> > +       my $name = $attr->{'name'};
> >         my $action = $attr->{'action'};
> >         $action = "" unless defined $action;
> >         $action = URI->new_abs($action, $base_uri);
> >         $f = $class->new($attr->{'method'},
> >                          $action,
> > -                        $attr->{'enctype'});
> > +                        $attr->{'enctype'},
> > +                        $name);
> >         push(@forms, $f);
> >         while (my $t = $p->get_tag) {
> >             my($tag, $attr) = @$t;
> > @@ -172,14 +175,16 @@
> >
> >  =item $form->enctype( [$new] )
> >
> > +=item $form->name( [$new] )
> > +
> >  These method can be used to get/set the corresponding attribute of the
> >  form.
> >
> >  =cut
> >
> >  BEGIN {
> > -    # Set up some accesor
> > -    for (qw(method action enctype)) {
> > +    # Set up some accessor
> > +    for (qw(method action enctype name)) {
> >     my $m = $_;
> >     no strict 'refs';
> >     *{$m} = sub {
>

Reply via email to