Hi, I'm working on a project that requires calling a perl function from the HTML code.
After searching online i found a tool called "Sajax" which can actually do this. http://www.modernmethod.com/sajax/
I made a simple application using this tool and it worked. I'm trying to use this tool in my form but its giving me weird errors.Presently i'm putting this tool to just print a string.
Actually i'm calling the javascript function add() on the onChange()event of a drop downbox which calls the perl wrapper function x_populate() to print a string.
I get the following error:-
Error: uncaught exception: [Exception... "Not enough arguments nsIDOMHTMLSelectElement.add" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: unknown filename> :: onchange :: line 0" data: no]
The strange part is if i call the add() function on the onClick() event of a button it actually works. I dont know whats the issue with the onChange() event.
I guess this is a javascript error but how to resolve it.
Sample Code:
function add(F){ x_populate(print1); } function print1(N1) { document.write(N1); document.write('Its Me'); } my $msub = sub { return 'Hey'; }; Sajax::rs_init(); Sajax::rs_register("populate",$msub); //followed by some other Sajax functions //calling add() function <SELECT NAME="selectCourseDept" onChange="add(); return false;">

In reply to Calling Perl function from HTML code - using SAJAX by Rainmaker

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.