From: Ryan K. <rya...@us...> - 2001-10-12 17:14:35
|
Update of /cvsroot/formmagick/formmagick/examples In directory usw-pr-cvs1:/tmp/cvs-serv16553 Modified Files: hello.pl hello.xml Added Files: hello-repeat.pl hello-repeat.xml Log Message: Now there is both a one-page and a two-page version of "hello" -- a wee bit easier to test now. --- NEW FILE --- #!/usr/bin/perl -w use strict; use lib "../../lib/"; use CGI::FormMagick; my $fm = new CGI::FormMagick(); $fm->display(); sub say_hello { my $cgi = shift; my $name = $cgi->param('name'); my $howmany = $cgi->param('howmany'); print "<h2>Hello, $name</h2>\n" x $howmany; return 1; } --- NEW FILE --- <FORM TITLE="Hello" HEADER="head.tmpl" FOOTER="foot.tmpl" POST-EVENT="say_hello"> <PAGE NAME="Name"> <TITLE>I'm the FormMagickian.</TITLE> <FIELD ID="name" TYPE="TEXT" VALIDATION="nonblank"> <LABEL>Your name?</LABEL> </FIELD> </PAGE> <PAGE NAME="Howmany"> <TITLE>I can repeat myself.</TITLE> <FIELD ID="howmany" TYPE="TEXT" VALIDATION="integer"> <LABEL>Enter a number</LABEL> </FIELD> </PAGE> </FORM> Index: hello.pl =================================================================== RCS file: /cvsroot/formmagick/formmagick/examples/hello.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** hello.pl 2001/10/11 16:22:03 1.1 --- hello.pl 2001/10/12 17:14:33 1.2 *************** *** 10,18 **** sub say_hello { ! my $cgi = shift; ! my $name = $cgi->param('name'); ! my $howmany = $cgi->param('howmany'); ! print "<h2>Hello, $name</h2>\n" x $howmany; ! print "<p>It is moderately nice to meet you.</p>\n"; return 1; } --- 10,19 ---- sub say_hello { ! my $cgi = shift; ! my $name = $cgi->param('name'); ! print qq( ! <h2>Hello, $name</h2> ! <p>It is moderately nice to meet you.</p> ! ); return 1; } Index: hello.xml =================================================================== RCS file: /cvsroot/formmagick/formmagick/examples/hello.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** hello.xml 2001/10/11 16:22:03 1.1 --- hello.xml 2001/10/12 17:14:33 1.2 *************** *** 6,14 **** </FIELD> </PAGE> - <PAGE NAME="Howmany"> - <TITLE>I can repeat myself.</TITLE> - <FIELD ID="howmany" TYPE="TEXT" VALIDATION="integer"> - <LABEL>Enter a number</LABEL> - </FIELD> - </PAGE> </FORM> --- 6,8 ---- |