added empty option if none of them is selected
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 27 Aug 2009 19:58:18 +0000 (19:58 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 27 Aug 2009 19:58:18 +0000 (19:58 +0000)
lib/PXElator/html.pm

index 64f55fb..80a3de5 100644 (file)
@@ -45,6 +45,7 @@ sub tt {
 sub select {
        my $name = shift;
        my $selected_option = shift;
+       unshift @_, '' unless $selected_option;
        return join("\n"        
                , qq|<select type=select name=$name>|
                , join("\n", map { my $selected = $_ eq $selected_option ? 'selected' : ''; qq|<option name=$_ $selected>$_</option>| } @_ )