annotate BoosterPack/scripts/.svn/text-base/pjx_objects_2_url.pl.svn-base @ 0:0d795f02a8bb tip

initial committ. what was I thinking?
author Robert McIntyre <rlm@mit.edu>
date Mon, 27 Sep 2010 16:57:26 -0400
parents
children
rev   line source
rlm@0 1 #!C:/strawberry/perl/bin/perl.exe
rlm@0 2
rlm@0 3 # this is an example script of how you would use coderefs to define
rlm@0 4 # your CGI::Ajax functions.
rlm@0 5 #
rlm@0 6 # NB The CGI::Ajax object must come AFTER the coderefs are declared.
rlm@0 7
rlm@0 8 use strict;
rlm@0 9 use CGI::Ajax;
rlm@0 10 use CGI;
rlm@0 11
rlm@0 12 my $q = new CGI;
rlm@0 13
rlm@0 14 my $exported_fx = sub {
rlm@0 15 my $value_a = shift;
rlm@0 16 my $iq = new CGI;
rlm@0 17 my $a = $q->param('a');
rlm@0 18 my $b = $q->param('b');
rlm@0 19 my $test = $q->param('test');
rlm@0 20 return(
rlm@0 21 'entered value was: ' . $value_a .
rlm@0 22 '<br/>a was: ' . $a . "..." .
rlm@0 23 '<br/>b was: ' . $b . "..." .
rlm@0 24 '<br/>test was: ' . $test . "..."
rlm@0 25 );
rlm@0 26 };
rlm@0 27
rlm@0 28
rlm@0 29 my $Show_Form = sub {
rlm@0 30 my $html = "";
rlm@0 31 $html .= <<EOT;
rlm@0 32 <HTML>
rlm@0 33 <HEAD><title>CGI::Ajax Example</title>
rlm@0 34 </HEAD>
rlm@0 35 <BODY>
rlm@0 36 <form>
rlm@0 37 this javascript object is sent in as an argument:
rlm@0 38 {'a':123,'b':345,'test':'123 Evergreen Terrace'}
rlm@0 39 <br/><br/>
rlm@0 40 Enter something else:&nbsp;
rlm@0 41 <input type="text" name="val1" size="6" onkeyup="myfunc(
rlm@0 42 ['val1',{'a':123,'b':345,'test':'123 Evergreen Terrace'} ], 'resultdiv' ); return true;"><br>
rlm@0 43
rlm@0 44 <hr>
rlm@0 45 <DIV id="resultdiv" style="border: 1px solid black; width: 440px; height: 80px; overflow: auto">
rlm@0 46 </div>
rlm@0 47 </form>
rlm@0 48 </BODY>
rlm@0 49 </HTML>
rlm@0 50 EOT
rlm@0 51
rlm@0 52 return $html;
rlm@0 53 };
rlm@0 54
rlm@0 55 my $pjx = CGI::Ajax->new( 'myfunc' => $exported_fx);
rlm@0 56 $pjx->JSDEBUG(2);
rlm@0 57 $pjx->DEBUG(2);
rlm@0 58 print $pjx->build_html($q,$Show_Form); # this outputs the html for the page
rlm@0 59