]>
Dogcows Code - chaz/p5-CGI-Ex/blob - cgi_ex_2.cgi
73e37e2d4cdece8f993d0e060486cfbf1f6083ed
11 ###----------------------------------------------------------------###
16 use base CGI
::Ex
::App
;
17 use CGI
::Ex
::Dump
qw(debug);
19 ###----------------------------------------------------------------###
25 push @$path, 'userinfo';
29 sub userinfo_ready_validate
{
31 return $self->form->{processing
} ? 1 : 0;
34 sub userinfo_hash_validation
{
36 'group order' => ['username', 'password'],
42 # could probably all be done with match => 'm/^\w{3,30}$/'
49 validate_if
=> 'password',
55 sub userinfo_hash_form
{
57 my $hash = $self->form;
58 $hash->{form_name
} = 'formfoo';
59 $hash->{js_val
} = $self->vob->generate_js($self->userinfo_hash_validation(),
61 "$ENV{SCRIPT_NAME}/js");
67 title
=> 'My Application',
68 script
=> $ENV{SCRIPT_NAME
},
69 color
=> ['#ccf', '#aaf'],
79 my $content = ($step eq 'userinfo') ? &get_content_form
()
80 : ($step eq 'main') ? &get_content_success
()
81 : "Don't have content for step \"$step\"";
83 $self->cgix->swap_template(\
$content, $form);
84 $self->cgix->fill(\
$content, $fill);
86 $self->cgix->print_content_type();
90 ### this works because we added /js onto $ENV{SCRIPT_NAME} above near js_val
93 my $info = $ENV{PATH_INFO
} || '';
94 if ($info =~ m
|^/js(/\w
+)+.js
$|) {
96 $self->cgix->print_js($info);
103 ###----------------------------------------------------------------###
105 sub get_content_form
{
109 <title>[% title %]</title>
119 <h1 style
='color:blue'>Please Enter information
</h1
>
120 <span style
='color:red'>[% error_header
%]</span
>
123 <form name
="[% form_name %]">
124 <input type
=hidden name
=processing value
=1>
127 <tr bgcolor
=[% color
.0 %]>
130 <input type
=text size
=30 name
=username
>
131 <span
class=error id
=username_error
>[% username_error
%]</span></td
>
133 <tr bgcolor
=[% color
.1 %]>
135 <td
><input type
=password size
=20 name
=password
>
136 <span
class=error id
=password_error
>[% password_error
%]</span></td
>
138 <tr bgcolor
=[% color
.0 %]>
139 <td
>Password Verify
:</td
>
140 <td
><input type
=password size
=20 name
=password_verify
>
141 <span
class=error id
=password_verify_error
>[% password_verify_error
%]</span></td
>
143 <tr bgcolor
=[% color
.1 %]>
144 <td colspan
=2 align
=right
><input type
=submit value
=Submit
></td
>
157 sub get_content_success
{
160 <head><title>[% title %]</title></head>
162 <h1 style='color:green'>Success</h1>
164 print "I can now continue on with the rest of my script!";
This page took 0.047274 seconds and 3 git commands to generate.