<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial><FONT size=2>Hello List, <EM>first-timer</EM> 
here.</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2>I've Googled around for info. on application 
menu systems, etc. Seems like a lot of sophisticated stuff out there. My 
approach is to dynamically load a drop-down (pop-up?) scrolling window from an 
<B>applications table</B> maintained in a MySQL database. -- Make a selection, 
and execute the associated executable object. Problem solved. </FONT></DIV>
<P><FONT size=2>I'm trying to use a mix of client-side JavaScript, and html, 
generated by Perl's CGI.&nbsp; A <I>state</I> problem apparently requires a 
second click on the <B>Execute Application</B> (i.e., Submit) button. On the 
first pass, the same <B>Applications Menu</B> panel is re-displayed. Second 
click, the requested application page is executed. Interesting, too, that if you 
go back to the menu, select another ap., the thing returns to the previous ap. 
after which you can return to the menu, click submit, yet again, on the next 
ap., and the next ap's page&nbsp;will be executed. It's probably worth noting 
that regarding the design and functionality, the Submit button click could be 
eliminated and the desired <STRONG>application could be immediately executed 
"-onclick"</STRONG> from the popup menu (if possible, . . .should be?), because 
the user will&nbsp;only select one row (i.e., application to execute)&nbsp;from 
the list: </FONT>
<P><FONT size=2>I've tried to follow examples and suggestions from David 
Flanagan's book, <U><STRONG>JavaScript</STRONG>, <EM>The Definitive 
Guide</EM></U>, O'reilly and Associates, 4th. ed., 2002,&nbsp;but I just can 
seem to find the solution.&nbsp; I guess I'm still not thinking through how the 
event-driven handlers on the client are interacting with the html that is 
generated by the server-side Perl code.</FONT> 
<P><FONT size=2>Here is a sample of code that almost works. Notice that the 
-action argument is omitted; therefore, defaults(?) to the current document): 
</FONT>
<P><FONT size=2>Using the CGI to start the form: </FONT><PRE><TT class=code><FONT size=2>print   header(),
        start_html(-title=&gt;$title, -bgcolor=&gt;"cyan"),
        checkForm(),
        $cgi-&gt;start_form(
                -name=&gt;"apps_menu",
                -method=&gt;"GET",
                -onsubmit=&gt;"return checkForm( this )"
);
</FONT></TT></PRE>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>. . .and a little farther down, notice that the 
"-onclick=&gt;set_apx( )" apparently is not recognized by the 
popup_menu()function (subroutine, . . .whatever); however; executing immediately 
after the call produces the somewhat desirable results. I did try placing the 
call to set_apx() inside the checkForm() routine that is called -onsubmit, but 
that did not work (browser complains of undefined or nonexistent object; . . 
.perhaps a scope problem).</FONT></DIV><PRE><TT class=code><FONT size=2># ------------------------------
# Display Application Menu.
# ------------------------------
print
qq(&lt;tr&gt;&lt;td width=\"175\" align=\"right\"&gt;
          &lt;b&gt;Application: &lt;/b&gt;&lt;/td&gt;&lt;td&gt;),
$cgi-&gt; popup_menu
(
        -name=&gt;'ap_name',
        -values=&gt;\@ap_names,
        -labels=&gt;\%ap_labels,
        -size=&gt;'8',
#       -onclick=&gt;set_apx()   Not good!</FONT>
<P><FONT size=2><FONT face=Arial>); # </FONT></FONT><FONT size=2><FONT face=Arial>BTW, . . .can't get anything like the following to compile w/o syntax errors<BR></P></FONT>
# -onclick=&gt;document.apps_menu.action=apps_menu['ap_name'].value;</FONT>);</TT></PRE><PRE><TT class=code>
<P><FONT size=2>set_apx(); <FONT face=Arial># Sort-of works here (as I've described), </FONT></FONT><FONT size=2><FONT face=Arial>but is outside of the popup_menu subroutine call.</FONT></FONT><P> 
<P><FONT face=Arial size=2>. . .and finally finish up the <I>main</I> with the usual suspects.</FONT><P> 
<P><TT class=code><FONT size=2>print br(), submit(-name=&gt;"action", 
-value=&gt;"Start Application"), reset, end_form(), end_html(); 
$dbh-&gt;disconnect(); exit(0);</FONT></TT> 
<P><FONT face=Arial size=2></FONT>
<P><FONT face=Arial size=2>Here is the "<I>Set Application to Exec.</I>" subroutine that generates the JavaScript:URL </FONT><P><FONT face=Arial size=2>that overrides the -action argument of the form tag generated by CGI.pm: </FONT><PRE><TT class=code><FONT size=2># ----------------------------------------------------
sub set_apx { # Generate the JavaScript:URL here:
   print qq(&lt;script&gt;&lt;!--
      document.apps_menu.action=apps_menu['ap_name'].value;
   // --&gt;&lt;/script&gt;);
}
</FONT></TT></PRE>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This event-sensitive, client-side JavaScript is obviously 
executing the desired application, but like an old diesel tractor, </FONT></DIV><DIV><FONT face=Arial size=2>. . .you have to double-clutch it. </FONT></DIV>
<P><FONT face=Arial><FONT size=2>Suggestions?</FONT>
</FONT><P><FONT face=Arial size=2></FONT>&nbsp;</P><P><FONT face=Arial size=2>Thanks &amp; OTTF,<BR>Ron Wingfield</FONT></P>
<P><FONT size=1><FONT face=Arial>FreeBSD 4.8&nbsp; --&nbsp; Apache http 2.0.28 -- MySQL 
client/server 4.1.7<BR>Perl 5.8.5 -- p5-DBD-mysql-2.9004 driver -- p5-DBI-1.46</FONT> 
<HR>
</FONT>
<P></P></FONT></TT>
</PRE></BODY></HTML>