Skip to content

Commit

Permalink
fix for RT#55789
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Wiger committed Sep 3, 2011
1 parent e82c055 commit c181383
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
9 changes: 5 additions & 4 deletions lib/CGI/FormBuilder/Source/File.pm
Expand Up @@ -156,17 +156,18 @@ sub parse {
@val = split /\s*,\s*/, $line;

# m=Male, f=Female -> [m,Male], [f,Female]
for (@val) {
$_ = [ split /\s*=\s*/, $_, 2 ] if /=/;
for (my $i=0; $i < @val; $i++) {
$val[$i] = [ split /\s*=\s*/, $val[$i], 2 ] if $val[$i] =~ /=/;
}
}

# only arrayref on multi values b/c FB is "smart"
if ($ptr->{$term}) {
$ptr->{$term} = (ref $ptr->{$term})
? [ @{$ptr->{$term}}, @val ] : @val > 1 ? \@val : $val[0];
? [ @{$ptr->{$term}}, @val ] : @val > 1 ? \@val :
ref($val[0]) eq 'ARRAY' ? \@val : $val[0];
} else {
$ptr->{$term} = @val > 1 ? \@val : $val[0];
$ptr->{$term} = @val > 1 ? \@val : ref($val[0]) eq 'ARRAY' ? \@val : $val[0];
}
$inval = 1;
} else {
Expand Down
4 changes: 4 additions & 0 deletions t/3a-source-file.t
Expand Up @@ -313,6 +313,10 @@ fields:
options: 0,1,2,3,4,5,6,7,8,9
jsclick: this.ham.value = "it\'s a pig, man!"
columns: 1
cb_input:
type: checkbox
label: Option
options: active=Have this item active
',
},

Expand Down
5 changes: 5 additions & 0 deletions t/3a-test17.html
Expand Up @@ -38,6 +38,11 @@
<option value="9">9</option>
</select></td>
</tr>
<tr valign="top">
<td>Option</td>
<td><input id="cb_input" name="cb_input" type="checkbox" value="active" /> <label for="cb_input">Have this item active</label>
</td>
</tr>
<tr valign="top">
<td align="center" colspan="2"><input id="_submit" name="_submit" type="submit" value="Submit" /></td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion util/retest
Expand Up @@ -24,7 +24,7 @@ do
echo "Failed test $f: $tnum"
testfile=`printf "t/$tnam-test%2.2d.html" $tnum`
[ -f $testfile ] || echo "Warning: $testfile does not exist" >&2
echo -n "Update output file $testfile (y/n)? [y] "
echo "Update output file $testfile (y/n)? [y] \c"
read ans
[ ${ans:-y} = y ] || continue
cp -fp $twofile $testfile
Expand Down
2 changes: 1 addition & 1 deletion util/runtests
@@ -1,5 +1,5 @@
#!/bin/sh
cd `dirname $0`
cd `dirname $0`/..
for f in t/*.t
do
echo "** $f"
Expand Down

0 comments on commit c181383

Please sign in to comment.