@@ -2036,9 +2036,12 @@ sub set_visible {
2036
2036
=head2 $mech->tick( $name, $value [, $set] )
2037
2037
2038
2038
"Ticks" the first checkbox that has both the name and value associated
2039
- with it on the current form. Dies if there is no named check box for
2040
- that value. Passing in a false value as the third optional argument
2041
- will cause the checkbox to be unticked.
2039
+ with it on the current form. If there is no value to the input, just
2040
+ pass an empty string or undef as the value. Dies if there is no named
2041
+ checkbox for the value given, if a value is given. Passing in a false
2042
+ value as the third optional argument will cause the checkbox to be
2043
+ unticked. The third value does not need to be set if you wish to
2044
+ merely tick the box.
2042
2045
2043
2046
=cut
2044
2047
@@ -2051,6 +2054,13 @@ sub tick {
2051
2054
# loop though all the inputs
2052
2055
my $index = 1;
2053
2056
while ( my $input = $self -> current_form-> find_input( $name , ' checkbox' , $index ) ) {
2057
+ # Sometimes the HTML is malformed and there is no value for the check
2058
+ # box, so we just return if the value passed is an empty string
2059
+ # (and the form input is found)
2060
+ if ($value eq ' ' ) {
2061
+ $input -> value($set ? $value : undef );
2062
+ return ;
2063
+ }
2054
2064
# Can't guarantee that the first element will be undef and the second
2055
2065
# element will be the right name
2056
2066
foreach my $val ($input -> possible_values()) {
0 commit comments