Solved

CGI.pm + radio_group + fonts

Posted on 2002-06-06
2
744 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Six Sigma Control Plans
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

635 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