[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] Now a problem with returning validation results


Hi,

   My brain's fried trying to figure this one out. 

   I intend to do form validation using the Data::FormValidator and the
CGI::Application::ValidateRM modules.

   Problem is, I need 'Missing' to appear automatically against the
fields I declared as required.

   For reference, here is a URL put up by Mark Stosberg that explains
exactly how to do this. I built my subroutines based on that but his
   template file displays 'Missing' while mine does not. I even pasted
his code on my system and that worked so it cannot be a system issue.
   Obviously I am going wrong someplace.

   The URL is http://mark.stosberg.com/dfv/

   The issue has something to do with using dfv_defaults. I just dont
know what!


   Given below is my setup and form subroutines. Sub A displays the
actual form while sub B processes it after submission



   Setup sub
  
---------------------------------------------------------------------  
 sub setup {

     my $self = shift;
     $self->start_mode('data_entry_user_details');
     $self->run_modes(
                     'data_entry_user_details' =>
'data_entry_user_details',
                     'data_entry_user_details_process' =>
'data_entry_user_details_process',
                     );

   }
  
---------------------------------------------------------------------  


   Sub A
  
---------------------------------------------------------------------  
sub data_entry_user_details {

     my $self = shift;
     my $errs = shift;

     my $data_entry_user_details_page =
$self->load_tmpl('data_entry_user_details.tmpl',
                                           die_on_bad_params => 0,
                                           cache => 1
                                     );

     $data_entry_user_details_page->param($errs) if $errs;
 
     $data_entry_user_details_page->param(mode_param_name =>
$self->mode_param);
     $data_entry_user_details_page->param(mode_param_value =>
'data_entry_user_details_process');

     return $data_entry_user_details_page->output;

   }
  
---------------------------------------------------------------------

   Sub B
  
---------------------------------------------------------------------  
sub data_entry_user_details_process {

     my $self = shift;

     my ($results, $err_page) = $self->check_rm
                                    ('data_entry_user_details',{
                                             required => [qw/
                                                      req_user_name,
                                                          /],
                                             optional => [qw/
                                                      ins_user_name,
                                                          /],
       # trim leading and trailing whitespace from all the valid fields
                                             filters => ['trim'],
                                             msgs => {
                                               any_errors => 'err__',
                                               prefix => 'err_',
                                                      },
                                     });

     return $err_page if $err_page;
     $self->data_entry_software_platform_license;
   }
  
---------------------------------------------------------------------

   And here is my template file. I have only included the absolutely
relevant sections. 

   The top line includes a template having a CSS file and nothing more.


  
---------------------------------------------------------------------  
<TMPL_INCLUDE NAME=top_screen_no_figures.tmpl>

   <!-- If any errors exist, throw a header message stating the fact.  
         That header can be used across multiple pages and is in 
              tmpl_include -->
   <!-- TMPL_IF NAME=err__ -->

        <TMPL_INCLUDE NAME=error_header.tmpl>

   <!-- /TMPL_IF -->

   
   <INPUT TYPE=TEXT NAME='req_user_name' VALUE='<TMPL_VAR
NAME='req_user_name' DEFAULT=''>' SIZE='25' MAXLENGTH='100'>
   &nbsp;
   <!-- TMPL_VAR err_req_user_name -->

   <!-- THE ABOVE CODE DOES NOT WORK! -->
  
---------------------------------------------------------------------

   Neither the <!-- TMPL_IF NAME=err__ --> nor the <!-- TMPL_VAR
err_req_user_name --> are effective.

   Please advise.

Thanks,
Sharad


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
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.