| First Name: |
|
.... BLAH BLAH BLAH
####
sub affiliate_create {
my ($app, $err) = @_;
# render the 'shell' and 'core' of the webpage
my ($s, $o) = $app->tree_guts_common
('Admin::Shell', 'Admin::Aff::Create');
# render (or remove) the error feedback
$o->error_feedback($err);
$s;
}
####
package Admin::Aff::Create;
use base 'Admin::Base';
sub file { 'admin/aff/create.html' }
sub error_feedback {
my ($tree, $err) = @_;
if ($err) {
$tree->iter2(wrapper_ld => [ id => 'form_errors_dl' ],
wrapper_data =>
[ map { [ $_ => $err->{$_} ] } (keys %$err) ],
debug => 0
);
} else {
$tree->look_down(id => 'form_errors')->delete;
}
}
1;
####
####
sub affiliate_create_process {
my $app = shift;
my ($results, $err_page) = $app->check_rm
('affiliate_create' , 'affiliate_create_form_profile');
if ($err_page) {
return $err_page;
} else {
return
"Successful form submission will forward to affiliate detail";
}
$results;
}
####
A little bit off topic to the HTML::FillInForm discussion (or maybe not).
But does anyone know of a module like HTML::FiF that would allow me to
fill in other things such as:
So that if I had a static HTML file with a form on it, I could place
the error message place holder right where I wanted them at the time
that I write the HTML and only activate them on submit by re-reading
the .html file and then using HTML::FiF to fill in the form AND the
appropriate Fill-In other module to fill in the empty with the
error messages and then return the entire output to the user.
I'm about on the edge of rolling my own in a fashion similar to
HTML::FillInForm, but thought I would check first. (Otherwise, I might
roll out HTML::FillInAnything)
I do understand that:
a) The concept for this module would be moot if I was generating the
form dynamically from a template that could include [% error_firstname
%] tags. Which I'm not. But in respect, what I'm looking for is also
cleaner than the syntax of , which is what we'd be left with if we didn't
have HTML::FiF in the first place.
b) I could probably do something like
and have the entire file re-parsed
by TT using HTML comment tags as my start / end tags, but I think the
fill in approach would still be cleaner.
|