Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CGI.pm + radio_group + fonts

Posted on 2002-06-06
2
Medium Priority
?
745 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

721 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