Skip Menu |
 

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

Report information
The Basics
Id: 12063
Status: new
Priority: 0/
Queue: HTML-FillInForm

People
Owner: Nobody in particular
Requestors: ask1about [...] yahoo.com
Cc:
AdminCc:

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



Subject: Problem With Array Field Of Different Sorts
Download (untitled) / with headers
text/plain 394b
$form->fill(scalarref => \$html, fdat => {'test'=>['123','456']}, ); <select name="test"> <option>123</option> <option>456</option> </select> <input type="text" name="test"> ------------------------------------------------------ In this case it turns out that both the 'select' field and 'text' field have the same value of "123"
Download (untitled) / with headers
text/plain 657b
Here I am 25min later with a solution patch... line 174 chang from $value = [ $value ] unless ( ref($value) eq 'ARRAY' ); to $value = [ shift @$value ] unless ( ref($value) eq 'ARRAY' ); [guest - Tue Mar 29 20:02:22 2005]: Show quoted text
> $form->fill(scalarref => \$html, > fdat => {'test'=>['123','456']}, > ); > > <select name="test"> > <option>123</option> > <option>456</option> > </select> > > <input type="text" name="test"> > > ------------------------------------------------------ > In this case it turns out that both the 'select' field and 'text' > field have the same value of "123"
Download (untitled) / with headers
text/plain 624b
Sorry guys my mistake that last fix has some bugs when dealign with many fields so a made a counter fix after looking into it a bit more. Scratch the last fix and do this: Add the following line $values = [shift @$values || ''] if ref($values) eq 'ARRAY'; in between line 252 and 253 252 $self->{output} .= ' selected="selected"'; 253 } I also tested this with multifield drop down and it works too. Hopefully it works everywhere. But don't take my fix withotu testing it yourselves, as you can see I'm not the most trustable source. As far as I checked wich was 15 minutes of testing this works.
Download (untitled) / with headers
text/plain 698b
Also, due to certain feilds apearing twice you might want to cancel repeating. Add this under 'sub fill' $self->{no_repeat} = $option{no_repeat}; and is '_sub_get_param' replace return undef if $self->{ignore_fields}{$param} with $self->{repeatcount}{$param}++; return undef if $self->{ignore_fields}{$param} or ($self->{no_repeat} == 1 and $self->{repeatcount}{$param} > 0); so by adding a no_repeat => 1 in your call you can turn of repeating. I what have made something like ignore_fields thing for repeats as well and a special no repeat that will repeat on similar fields only. but I don't have the tiem for that, maybe the author of this module may plan on adding it.
Download (untitled) / with headers
text/plain 701b
Again a mistake on the repeating though, so ignore that and here is the right way Add this under 'sub fill' after the my headers $self->{no_repeat} = $option{no_repeat}; and is '_sub_get_param' replace return undef if $self->{ignore_fields}{$param} with return undef if $self->{ignore_fields}{$param} or ($self->{no_repeat} == 1 and $self->{repeatcount}{$param} > 1); Add this under 'sub start' after the my headers $self->{repeatcount}{$attr->{'name'}}++ if ref($self->{fdat}{$attr-> {'name'}}) ne 'ARRAY'; Add this under 'sub start' after "} elsif (lc $attr->{'type'} eq 'radio'){" $self->{repeatcount}{$attr->{'name'}}--; the reason is cause radio boxes and other stuff.
Download (untitled) / with headers
text/plain 199b
the above no repeat does may still repeat array references so you mgith nead to add the $# of the array to the 1. make sure you use the cahced version or the array size wil ldecrease and wont work.
Download (untitled) / with headers
text/plain 608b
okay since the update of HTML Parser, my patch seems to have crashed....so $self->{repeatcount}{$attr->{'name'}}++ if (ref($self->{fdat}{$attr-> {'name'}}) ne 'ARRAY'); Needs to be changed to if ($tagname eq 'input' or $tagname eq 'radio' or $tagname eq 'checkbox' or $tagname eq 'select') { $self->{repeatcount}{$attr->{'name'}}++ if (ref($self->{fdat}{$attr-> {'name'}}) ne 'ARRAY'); } or you can make it if ($tagname=~m/^(?:input|radio|checkbox|select)$/) { $self->{repeatcount}{$attr->{'name'}}++ if (ref($self->{fdat}{$attr-> {'name'}}) ne 'ARRAY'); } depending the way you like ;)
Download (untitled) / with headers
text/plain 359b
I'm not sure I understand, why would you have two different types of fields with the same name? Why not just rewrite the HTML code to: <select name="test1"> <option>123</option> <option>456</option> </select> <input type="text" name="test2"> To support having two different fields with the same name seems like a lot of extra complication.
Download (untitled) / with headers
text/plain 996b
It is often the case that arrays are needed. even cgi.pm comes with ARRAY capability. Checkboxes also count as an array. so if you have more then one selected. you can't fill them in now can you? What do you like? <input type="text" name="like" value="cats"> Cats <input type="text" name="like" value="dogs"> Dogs <input type="text" name="like" value="birds"> Birds <input type="text" name="like" value="dragons"> Dragons Are you saying you want me to give each checkbox its own name? that can be rather cynical. also for multiple select box will work as well. [TJMATHER - Thu Oct 13 16:28:01 2005]: Show quoted text
> I'm not sure I understand, why would you have two different types of > fields with the same name? Why not just rewrite the HTML code to: > > <select name="test1"> > <option>123</option> > <option>456</option> > </select> > > <input type="text" name="test2"> > > To support having two different fields with the same name seems like a > lot of extra complication.
Download (untitled) / with headers
text/plain 625b
As for different fields, well its because lets say "Security Question". In it you have a drop down for questiosn and texfield for answer. This requires differnet types and you may want to group it. [TJMATHER - Thu Oct 13 16:28:01 2005]: Show quoted text
> I'm not sure I understand, why would you have two different types of > fields with the same name? Why not just rewrite the HTML code to: > > <select name="test1"> > <option>123</option> > <option>456</option> > </select> > > <input type="text" name="test2"> > > To support having two different fields with the same name seems like a > lot of extra complication.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.