Menu

#3 TMPL_IF

open
nobody
None
5
2011-09-26
2011-09-26
joschi03
No

Hi
I loop through a list of dropdown values and want ti add "selected" at the right value. Till now I do it as follows:
<TMPL_EACH dropdowns.serverType>
<option value="<TMPL_VAR __key__>" <%perl my $v = __ROOT__->{srvPup}->{srvType}; __OUT__ "selected" if(defined($v) && $__key__ eq $v);%>>
<TMPL_VAR __value__>
</option>
Do you know a better way? It would be great to be able to compare two values in the HTML_IF tag, wouldn't it?

Thanks,
joschi

Discussion


Log in to post a comment.