File: pjx_url.pl

package info (click to toggle)
libcgi-ajax-perl 0.707-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 1,669; makefile: 2
file content (43 lines) | stat: -rwxr-xr-x 971 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/perl -w

# this is an example script of how you would use URLs to define
# your CGI::Ajax functions.

use strict;
use CGI::Ajax;
use CGI;

my $q = new CGI;

# the format here implies that 'convert_degrees.pl' is at the same
# level in the web server's document root as this script.
my $pjx = CGI::Ajax->new( 'myfunc' => 'convert_degrees.pl');
$pjx->JSDEBUG(1);

my $Show_Form = sub {
  my $html = "";
  $html .= <<EOT;
<HTML>
<HEAD><title>CGI::Ajax Outside URL Example</title>
</HEAD>
<BODY>
<form>
  Degrees Centigrade:&nbsp;
  <input type="text" name="val1" id="val1" size="6"
    onkeyup="myfunc( ['Centigrade__' + getVal('val1')], ['val2'] );
    return true;">
  <br/>

  Degrees Kelvin:&nbsp;
  <input type="text" name="val2" id="val2" size="6"
    onkeyup="myfunc( ['Kelvin__' + getVal('val2')], ['val1'] );
    return true;">
</form>
</BODY>
</HTML>
EOT

  return $html;
};

print $pjx->build_html($q,$Show_Form); # this outputs the html for the page