@@ -2069,9 +2069,12 @@ sub set_visible {
2069
2069
=head2 $mech->tick( $name, $value [, $set] )
2070
2070
2071
2071
"Ticks" the first checkbox that has both the name and value associated
2072
- with it on the current form. Dies if there is no named check box for
2073
- that value. Passing in a false value as the third optional argument
2074
- will cause the checkbox to be unticked.
2072
+ with it on the current form. If there is no value to the input, just
2073
+ pass an empty string or undef as the value. Dies if there is no named
2074
+ checkbox for the value given, if a value is given. Passing in a false
2075
+ value as the third optional argument will cause the checkbox to be
2076
+ unticked. The third value does not need to be set if you wish to
2077
+ merely tick the box.
2075
2078
2076
2079
=cut
2077
2080
@@ -2084,6 +2087,13 @@ sub tick {
2084
2087
# loop though all the inputs
2085
2088
my $index = 1;
2086
2089
while ( my $input = $self -> current_form-> find_input( $name , ' checkbox' , $index ) ) {
2090
+ # Sometimes the HTML is malformed and there is no value for the check
2091
+ # box, so we just return if the value passed is an empty string
2092
+ # (and the form input is found)
2093
+ if ($value eq ' ' ) {
2094
+ $input -> value($set ? $value : undef );
2095
+ return ;
2096
+ }
2087
2097
# Can't guarantee that the first element will be undef and the second
2088
2098
# element will be the right name
2089
2099
foreach my $val ($input -> possible_values()) {
0 commit comments