%method title>Register%method>
<%method headline>Register:%method>
ARGS = <% sort keys %ARGS %>
@form::err = <% @form::err %>
% # treat any errors
% if (@form::err) {
The following errors were encountered:
% while (my $err = pop @form::err) {
- <% $err %>
% }
% }
Please register:
<%init>
@form::err = ();
# if a SUBMIT button, check form input
push (@form::err, "INIT");
if ($ARGS{submit}) {
push (@form::err, "SUBMIT present");
}
%init>
<%doc>
if ($ARGS{submit}) {
push (@err, "SUBMIT present");
# check for required input
push (@err, "Username is required") unless $ARGS{Username};
push (@err, "Password is required") unless $ARGS{Password};
push (@err, "Password must be entered twice") unless $ARGS{Password2};
push (@err, "Email is required") unless $ARGS{Email};
# check for heinous input
push (@err, "Passwords must exactly match")
unless $ARGS{Password} eq $ARGS{Password2};
# $m->redirect('/user/welcome.html');
}
# otherwise just present a blank form for input
%doc>