Gossamer Forum
Home : General : Perl Programming :

If YES, input this image; else input this

Quote Reply
If YES, input this image; else input this
Hi,

What I want to do is, if a field is selected as yes to show a particular image..and if it's selected as no to show another image. I can do it in site_html.pl but w/ the templates I am getting unknown tag errors..most likely because i didn't do it right. here is what i have so far. Also the field that has the yes or no is name isJava

Quote:
my $java = "";

($rec{'isJava'} eq 'Yes') ? ($rec{'isJava'} = 1) : (delete $rec{'isJava'});

if ($rec{'isJava'} eq "Yes") { $output .= qq| <a href="<%sunurl%>"><img src="/images/java.gif" width="32" height="32" border="0" alt="Use of Java"></a> |; }
else { $output .= qq| <img src="/images/java2.gif" width="32" height="32" border="0" alt="NO Java"> |; }


then I added this: java => $java
to the section after:
Quote:
return &load_template ('link.html', {



I then added this to my detail template:
Quote:
<%if isJava%>
<%java%>
<%endif%>


Thanks in advance.