Solved

CGI.pm + radio_group + fonts

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl troubleshooting error. Base64 bootstrap parameter 5 63
Font that uses "minimal ink" when printing 27 59
Web browser fonts have gone wild. 8 114
File Find regex problem 4 60
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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.…
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now