On Wed, 13 Apr 2005, Emanuele Zeppieri <suppressed> wrote:
>> -----Original Message-----
>> [...]
>>
>> The reason for this is in the nature of $return_page. For
>> H::T-generated
>> templates it is scalar data (ie the complete HTML return
>> page), but for
>> Template-generated templates it prints out as
>> 'SCALAR(0x1bfa330)'. As it
>> says in the CGI::Application::Plugin::TT docs for tt_process() 'The
>> return value will be a scalar reference to the output of the
>> template.'
>>
>This is not a problem, since a CGI::Application run mode can return
>either a text or a text reference (as a matter of fact CAP::TT and
>CAP::ValidateRM work together seamlessly).
>
>Your problem must reside somewhere else, and it's probably not related
>at all with CAP::ValidateRM: for debugging purposes, don't use
>CAP::ValidateRM and just check (by calling it directly) if your form
>display run mode correclty generates its output with CAP::TT.
>The problem must be there, since if this run mode works (with CAP::TT)
>when called directly, it must also work when invoked by
>CAP::ValidateRM::check_rm()
>
>(Check the way you are referencing your TT variables into your TT
>template, and check that you are just returning from and not directly
>printing anything from inside your C::A run modes).
>
>Ciao,
>Emanuele.
Thanks, if it helps, these are the two subs responsible. form_display()
displays the page correctly on first parsing, providing I supply an
empty hashref to $errors, as tt_process() requires a hashref in its
arguments. Then when I submit the form with empty (but required) fields,
form_process() is invoked, which incorrectly returns the 'success' page
because $errors is empty.
sub form_display {
my $self = shift;
my $errors = shift || {}; # print $fh Dumper($errors); # hashref of
errors
return $self->tt_process($errors); # produces scalarref which doesn't
work in ValidateRM::check_rm()
}
sub form_process { # called by hidden 'rm' field in form_display()
template
my $self = shift;
my ($results, $errors) = $self->check_rm('form_display',
'_form_profile'); # field defs. in _form_profile()
if ($errors) {
return $errors;
}
else {
#.. do something with DFV $results object now
$self->menu(); # go to menu if success
}
}
The output of form_display() ie $self->tt_process($errors), is a
scalarref. The equivalent output from form_display() if using H::T
instead is a scalar. Presumably for C:A:ValidateRM to work correctly
with TT the value of $self->tt_process($errors) needs to be a scalar
also, but how to do that?
--
Richard Jones
Leeds, UK
mailto:suppressed
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.