diff options
author | ivan <ivan> | 2010-02-04 20:39:56 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-02-04 20:39:56 +0000 |
commit | 4cacb3fa439b56fc7c9a742b69ec3f6ffd660433 (patch) | |
tree | 7b91bf502c5bcc974b30431fd8c96bf0bfab3288 /httemplate/elements/select-table.html | |
parent | 1bfbab83c338f6a11ae26c4d197ad775c568ebde (diff) |
discounts, RT#6679
Diffstat (limited to 'httemplate/elements/select-table.html')
-rw-r--r-- | httemplate/elements/select-table.html | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html index 4d8d9a988..3e25c9f49 100644 --- a/httemplate/elements/select-table.html +++ b/httemplate/elements/select-table.html @@ -31,6 +31,7 @@ Example: #basic params controlling the resulting <SELECT> 'pre_options' => [ 'value' => 'option' ], #before normal options + 'post_options' => [ 'value' => 'option' ], #after normal options 'empty_label' => '', #better specify it though, the default might change 'multiple' => 0, # bool 'disable_empty' => 0, # bool (implied by multiple) @@ -103,6 +104,16 @@ Example: %> % } +% while ( @post_options ) { +% my $post_opt = shift(@post_options); +% my $post_label = shift(@post_options); +% my $selected = ( ref($value) && $value->{$post_opt} ) +% || ( $value eq $post_opt ); + <OPTION VALUE="<% $post_opt %>" + <% $selected ? 'SELECTED' : '' %> + ><% $post_label %> +% } + </SELECT> %} @@ -180,6 +191,7 @@ if ( ref( $value ) eq 'ARRAY' ) { $value = { map { $_ => 1 } @$value }; } -my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : (); +my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : (); +my @post_options = $opt{post_options} ? @{ $opt{post_options} } : (); </%init> |