in reply to Creating HREF links on radio group items

As I do not exactly know what you are asking for I just added some links as follows. CGI.pm is your friend as always :-). So I'd suggest:

print radio_group (-name => "item", -value => ["B","T","S","M"], -labels => { 'B' => 'Item '.a({href=>"/help/b.html";},"B").' + ($10)', 'T' => 'Item '.a({href=>"/help/b.html";},"T").' + ($50)', 'S' => 'Item '.a({href=>"/help/b.html";},"S").' + ($200)', 'M' => 'Item '.a({href=>"/help/b.html";},"M").' + ($500)' }, -linebreak => 1);
If thats not what you've been looking for please feel free to elaborate on the task :-)


Have a nice day
All decision is left to your taste
Update
Fixed single quotes after "'Item " . Yes, just cut'n paste woes. :-)

Replies are listed 'Best First'.
Re: Re: Creating HREF links on radio group items
by Hero Zzyzzx (Curate) on Jun 21, 2002 at 18:53 UTC

    You'll need to undef autoEscape if you want this to work here, otherwise the labels will be the actual HTML generated by the a() method.

    autoEscape(undef); print radio_group (-name => "item", -value => ["B","T","S","M"], -labels => { 'B' => 'Item '.a({-href=>"/help/b.html"},"B").' + ($10)', 'T' => 'Item .a({-href=>"/help/b.html"},"T").' +($50)', 'S' => 'Item .a({-href=>"/help/b.html"},"S").' +($200)', 'M' => 'Item .a({-href=>"/help/b.html"},"M").' +($500)' }, -linebreak => 1); autoEscape(1);
    You'll also need to import the autoEscape method, by adding
    use CGI qw/:standard autoEscape/;

    Maybe there's a more elegant way to do this? Anyone?

    Update: Fixed syntax errors I cut-and-copied. . .

    -Any sufficiently advanced technology is
    indistinguishable from doubletalk.

      Well, ok, I didn't think so far for now :-)
      Ok and the URL's also should be the ones for the documents then and not a unique one, ok.
      But in CGI.pm's POD there seems to be no such Pragma -autoEscape, but that might be due to the fact that I read the docs on my PC where not the newest AS Perl and hence not the newest CGI.pm is installed. The docs rather say "By default, all HTML that is emitted by the form-generating functions is passed through a function called escapeHTML() ..." and "... To turn autoescaping off completely, use autoescape() ..." along with samples.

      Have a nice day
      All decision is left to your taste
      I simplified an item line,

      "B" => a({href=>"/test.html";},"B"),

      but I get the error:

      syntax error at /usr/local/apache/cgi-perl/work/script.pl line 95, at EOF

      Line 95 is the line I give above.

      Any idea why I'm getting this error?

        That's because your call to a() is wrong, it should be:

        a({-href=>"/test.html"},"B")
        Note the addition of the the - and the removal of the ;
        Goes to show what happens when I just cut-and-paste code, without really reading it. . .

        -Any sufficiently advanced technology is
        indistinguishable from doubletalk.

        got it. the semicolon should not be there.