Perl File snippet: <SCRIPT LANGUAGE="JavaScript" SRC="/js_validation/js.js"></SCRIPT> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +"> </head> <body> <form onsubmit="return formValidator()"> <table> <tr><td> Test Field: <input type="text" value="--" size="2" maxlength="2" id="p +lace"><br></td> </tr> <input type='submit' value='Check Form'><br> Javascript: /* SOURCE FILE: form_validation.js */ function formValidator(){ var place = document.getElementById("place"); if(isNumeric(place, "Please enter a valid zip code")){ return true; } return false; } function isNumeric(elem, helperMsg){ var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } Unfortunately, because I'm a newbie I don't really understand how to u +sefully incorporate the various modules that are out there. I instal +led the JavaScript::DataFormValidator module this morning, but am not + sure how to incorporate it yet. The only modules I am utilizng in m +y program currently are DBI and CGI. I don't really know the details + of what they do. I just know that the tutorials I've been taking to +ld me to use them :) The idea of putting my javascript into a perl string is intriguing. H +owever, it seems that my code could get real messy real quick. Is it + common in Perl to call functions/variables/etc from an external Perl + file (like you can in JS "..SRC="/js_validation/js.js"></SCRIPT>" )? If so, maybe storing my javascript in a variable within an external fi +le would be a good way to do this?

In reply to Re^2: Perl - calling javascript funciton by ax1lla
in thread Perl - calling javascript funciton by ax1lla

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.