Appy16 has asked for the wisdom of the Perl Monks concerning the following question:
I am posting my script below
what i want to do is pass the fns's value to the subroutine and return a value.#!/usr/bin/perl -w use CGI::Ajax; use CGI; sub functions { my $Fn = $_Get['Function']; my $input = shift; if(1) { return ("True"); } if(0) { return ("False"); } } sub Show_HTML { my $html = <<EOT; <HTML> <HEAD><title>Perl and HTML</title> </HEAD> <BODY> <script type="text/javascript"> function CheckIsNumeric() { var AsciiCode = event.keyCode; if ((AsciiCode < 48) || (AsciiCode > 57)) { alert('Please enter only numbers.'); event.cancelBubble = true; event.returnValue = false; } } </script> <Form method="Get"> <select name="Function"> <option value="0" selected>(please select:)</option> <option value="1">Func1</option> <option value="2">Func2</option> </select> Enter a number: <input type="text" name="Number" id="myText" size="6"onkeypress =" +CheckIsNumeric()"/> Enter a function: <input type="text" name="fns" id="URI" size="25"> <input type='Submit' onsubmit="functions('fns');" value='Submit' / +> </Form> <hr> <div id="resultdiv"> </div> <br> </BODY> </HTML> EOT return $html; } my $cgi = new CGI(); my $pjx = new CGI::Ajax( 'functions' => \&functions ); print $pjx->build_html($cgi,\&Show_HTML);
Kindly Help. Thanx in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl in HTML
by moritz (Cardinal) on Apr 15, 2010 at 08:03 UTC | |
by 7stud (Deacon) on Apr 15, 2010 at 10:17 UTC | |
|
Re: Perl in HTML
by almut (Canon) on Apr 15, 2010 at 08:34 UTC | |
|
Re: Perl in HTML
by Corion (Patriarch) on Apr 15, 2010 at 08:04 UTC |