I'd rather be able to keep the javascript separate if there is a way to do so...

You can always generate it as a separate file, and link it into your HTML. Also, Perl has a number of Templating modules, such as HTML::Template and Template Toolkit, which are designed to cleanly pull the HTML (and, by extension, Javascript embedded in HTML and/or "pure" Javascript files) formatting out of your Perl code.

*EDIT because I forgot to put this back in* To reference the answer from the Javascript in the HTML you're creating, you'll need, ironically, to set the Value of the textfield to equal the value of the Javascript -- although there are other ways, this might be the cleanest. You would do something like document.getElementById("response1”).value = "text_of_answer" to set it, and you can put it where you need to within the Javascript itself.

Having said that...if you're unfamiliar with Javascript, you're likely best to do some research and testing with static files containing HTML and Javascript, and then come back to implementing CGI. Even if your values are from CGI forms, you can just use a test variable and roll with it.

You're trying to cover a LOT of newtech in one go, and I think, from reading your past writeups, this might be causing you frustration. Take one chuck of tech (HTML, Javascript, Perl, etc.) at a time, play with them, and you should find great success!

*Another minute, another EDIT...* Try the new Mozilla Javascript site -- it's basically the replacement for the site in the CGI docs you found was dead.

Goes off to check into making a small patch to the CGI.pm docs...

----Asim, known to some as Woodrow.


In reply to Re^4: obtaining yyyy-mm-dd via a calendar object by Asim
in thread obtaining yyyy-mm-dd via a calendar object by gmacfadden

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.