Hello,

In one frame of a frameset, I have a radio group that allows for a selection at two levels with an embedded set of buttons. When a user selects (which survey type-which year) via the radio group, a perl–cgi script is activated. The resulting data (less than half a line) is printed out on this same frame. My interest is to maintain the radio buttons as selected for the user to see, but when activating this frame by clicking a second level radio button, the buttons collapse(lower level disappears) to their pre-selected state. I thought of using a textfield to which the data could be passed passively with the required script moved to another frame,which seems clumsy or of adding another thin frame to where the perl-cgi script could be moved and activated across frames,allowing the resulting data to be printed out directly, keeping the radio group intact as selected.

A third and maybe more ‘monkish’ approach could be to maintain the state of the selected radio group, but I’m not sure how to start or if it is at all appropriate here. I saw there is a store and restore trick with  $q->save(FILEHANDLE)and  $q = new CGI(FILEHANDLE), but can I save/return just the radio button selection? How (where) do I alter the script?

#!/usr/local/bin/perl -w use DBI; use DBD::mysql; use CGI qw(:standard); $query = new CGI; use CGI::Carp qw(fatalsToBrowser); my $JSCRIPT = <<EOF; function doit(which){ //SETTING RADIO BUTTONS var num = 3; //NUMBER OF SUB-MENU'S TO SHOW/HIDE //; for(var count=1;count<=num;count++)\{ var div = document.getElementById('subDiv'+count); if(count==which){ div.style.display = 'inline';} else{div.style.display = 'none';} } } EOF ; print $query->startform(-name=>'depts'); print b("Choose the type of data:"),p; ….. print "<label><input type='radio' name='RadioGroup1' value=1 onClick=' +doit(3)'>\n"; print "graphics</label>\n"; print "<span id='subDiv3' style='display:none'>\n"; #float:left with s +tyle, puts subgrp line below print "<label><input type='radio' name='RadioGroup2' value='graphics7' + onClick='pass(this.value)'>\n"; print "2007</label>\n"; print "<label><input type='radio' name='RadioGroup2' value='graphics8' + onClick='pass(this.value)'>\n"; print "'08</label>\n"; print "<label><input type='radio' name='RadioGroup2' value='graphics9' + onClick='pass(this.value)'>\n"; print "'09</label></span></div>\n"; ……. sqlQuery my $mosyr_ref = surveymos(\@dblist); …….. print h4(u('Survey Months with Violations:'),"&nbsp $mosyr[0]&nbsp $mo +syr[1]"); #RESULTING DATA
Thanks for your help

In reply to How do I maintain a radio button selection by lev

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.