Solved

CGI.pm + radio_group + fonts

Posted on 2002-06-06
2
737 Views
Last Modified: 2013-12-03
Hi

How do I implement other fonts in the following example:

...
print $q->radio_group(-name=>'something',
                         -values=>['foo','bar'],
                         -default=>'foo',
                         -rows=>'2'
    );

I need to get it into the "foo and bar" lines...
ex:
-values=>['$q->span({-style=>'Color: red;'},'foo','bar'],

Regards
Claes Lindvall

0
Comment
Question by:cl071997
2 Comments
 
LVL 10

Expert Comment

by:rj2
ID: 7065934
If what you want here is red text on the radio buttons, you can use code below for that.

#!/usr/bin/perl
use CGI qw(:standard);
print header,
     start_html(-style=>'TD {color: red}'),    
     radio_group(-name=>'something',
                        -values=>['foo','bar'],
                        -default=>'foo',
                        -rows=>'2'
        );  
print end_html;


0
 
LVL 4

Accepted Solution

by:
dda earned 500 total points
ID: 7066537
If you want to change color for all buttons - you can use rj2's solution. If you want to be able to set different colors to different buttons, you can try the following:

#=========

$q->autoEscape(0);

print $q->radio_group(-name=>'something',
                        -values=>['foo','bar'],
                        -labels=>{'foo' => 'foo', 'bar' => '<span style="color: red">' . "bar" . '</span>'},
                        -default=>'foo',
                        -rows=>'2'
   );

$q->autoEscape(1);

#=========

I use 'labels' parameter to supply button labels, and autoEscape(0) turns off HTML entities escaping inside arguments.

Regards,
Dmitry.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question