Hi Monk
I am working on a web application which looks like

Case I

Given a hostname provided in the text field if I press the
"Show jobs" button, it submits a form and loads the
same page with a popup_menu populated under the text
field and "Show jobs" button with all the jobs
running on that host.
Now I select a job in the popup_menu by a mouse click
on the values listed in the popup_menu. All fine so far.

Case II

Now to the right-hand side of this case -I gui objects, I
have another text field and "Show jobs" button. If I carry
out the same operation as I did in case-I on this
text-field and "Show jobs" at the right-hand side , it
submits the form and fetches one more popup_menu with
all the jobs running on this new host.
In addition to that the case-I text-field, submit button and popup_menu also appears on the reloaded page.
But the problem is the Case-I selection in the popup_menu is getting lost.

Please help me on how can I retain that Case-I selection as well when the page is submitted in Case-II and reloaded.
A sample code I am giving here below, the variables used in popup_menu are the usual array refs used in any such implementation and $qry is the cgi object.

<table border=0> <tr> <th bgcolor="#CCCCEE">First_Host</th><th>&nbsp;</th><th +bgcolor="#CCCCEE">Second_Host</th> </tr> <tr align=center> <td nowrap>@{[ $qry->textfield(-name=>'HOST_1') . '&nbsp; +' . $qry->submit(-name=>'HOST_1_LIST', -value=>'Show jobs') ]}</td> <td>&nbsp;</td> <td nowrap>@{[ $qry->textfield(-name=>'HOST_2') . '&nbsp; +' . $qry->submit(-name=>'HOST_2_LIST', -value=>'Show jobs...') ]}</td +> </tr> <tr align=center> <td bgcolor="#EEEEEE">@{[ $qry->popup_menu(-id=>'PM1', -n +ame=>'PM1_JOBS', -size=>10, -values=>$old_values, -labels=>$old_label +s, -multiple=>'false', -override=>'true', -onChange=>"fetchjobs(id,'' +,'','')") ]}</td> <td bgcolor="#EEEEEE">@{[ $qry->popup_menu(-id=>'PM2', -nam +e=>'PM2_JOBS', -size=>10, -values=>$new_values, -labels=>$new_labels, + -override=>'true', -onChange=>"fetchjobs(id,'','', '')") ]}</ +td> </tr> </table>

In reply to How to retain popup_menu selection between form submission by ghosh123

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.