On 6/26/07, Alex Malek <[EMAIL PROTECTED]> wrote:
> The problem is in HTML::Form.pm
> I had the same issue and I wrote a fix for Form.pm
> I am attaching it.
>
> Let me know if it helps.
>
> ---Alex
On 6/26/07, Paul Robbins <[EMAIL PROTECTED]> wrote:
What change did you make?



The problem is the way Form.pm deals with multiple form select options
with the same name.

I altered Form.pm to handle that case.

What you need to do is either replace Form.pm with the one I sent you
or put it in a place in your path where it is used first.

Below is the diff of the original Form.pm and and my new version.


153a155,156
 #select/option start code
 $attr->{START}="true";
156c159,164
<  last if $tag eq "/select";
---
 if ($tag eq "/select") {
 #some select/option end code
 $attr->{END}="true";
 $f->push_input("option", $attr);
 last;
 }
172a181,183
 if ($attr->{START}) {
 delete $attr->{START}; #after first use remove
 }
188a200,202
 #some select/option end code
 $attr->{END}="true";
 $f->push_input("option", $attr);
823c837,851
<  return $self->SUPER::add_to_form($form) unless $prev;
---
 # for option
 if ($type eq "option") {
 if ( defined $self->{START}) {
 return $self->SUPER::add_to_form($form);
 }
 my $i=1;
 while ($prev && (! defined $prev->{START}) ) {
 $prev = $form->find_input($self->{name}, $self->{type}, $i++);
 }
 if ( defined $prev->{START} && defined $self->{END}) {
 delete $prev->{START};
 return;
 }
 }
 return $self->SUPER::add_to_form($form) unless ($prev );

Reply via email to