I thought that I could buy wisdom in the form of yet another $45 book (JavaScript, the Definitive Guide, David Flanagan, O'Reilly and Assoc., 4th. ed., 2002), and it is well written; however, I am struggling with this code.
print $cgi->start_form( -name=>"apps_menu", -method=>"GET", -action=>'javascript:ap_namex', -onsubmit=>"return checkForm( this );" );
The following Perl/JavaScript:URL scenario successfully assigns the value from a drop-down menu to the previously ,declared "global" var, ap_namex.
-onclick=>"javascript:ap_namex=form['ap_name'].value"
. . .however, the "-action" taken "-onsubmit" is not what I expected. Essentially, I am (am I?) trying to "globally scope" a JavaScript var and convey an assigned value to the Perl environment, such that the "-action" operation will execute the desired URL as though it were hard-coded, e.g., -action=>"contacts_01.pl",.

When the javascript:URL executes as per the above code, the URL displayed in my MS/IE v6+ remains the same as the "parent"; however, the displayed name of the window becomes javascript:ap_namex, the window panel is all white except, the value, "contacts_01.pl" is displayed, . . .the only html in the displayable source.

Apparently, the print $cgi->etc. is printing the value of the JavaScript variable, rather than executing it as per my intention. Obviously, I haven't connected all of the dots?

Suggestions?

Thanks, Ron W.


In reply to JavaScript to Perl: "-action" "-onsubmit" by rtwingfield

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.