Solved

CGI.pm + radio_group + fonts

Posted on 2002-06-06
2
725 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
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.
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…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now