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

[cgiapp] Problem with modes.


Hi,

   First up. Sorry for the empty post sent earlier. Need more sleep ;)

   I am using a series of 4 run modes for a module. Each of the first 
   3 modes displays an HTML template screen where a user could enter
   data.

   In each HTML::Template file, I have a hidden variable like so:

   <INPUT TYPE=HIDDEN NAME='rm' VALUE='<TMPL_VAR 
                 NAME='run_mode_value'>'>

   I will be setting that run_mode_value from within my run mode
subroutines like so:

   mode1_sub {

    # Use load_tmpl to load template 1

    # $template->param('run_mode_value' => 'mode2_sub')

   }

   mode2_sub {

    # Use load_tmpl to load template 2

    # $template->param('run_mode_value' => 'mode3_sub')

   }

   mode3_sub {

    # Use load_tmpl to load template 3

    # $template->param('run_mode_value' => 'mode4_sub')

   }

   mode4_sub {

      # do something else

   }

    
   So far, so good

   
   Now, I want to add form validation for each of the first 3 mode
screens. I propose to do this using CGI::Application::ValidateRM.
   This would mean introducing 3 'new' run modes for the sake of
processing those forms. I am unable to figure out a way where, if the
   form processing is successful, the user can go to the next mode. I
am pasting below the way my code looks after introduction
   of 3 new modes. It also contains the place where I am facing an
issue.


   mode1_sub {

    # Use load_tmpl to load template 1

    # $template->param('run_mode_value' => 'mode1_process_sub')

   }

   mode2_sub {

    # Use load_tmpl to load template 2

    # $template->param('run_mode_value' => 'mode2_process_sub')

   }

   mode3_sub {

    # Use load_tmpl to load template 3

    # $template->param('run_mode_value' => 'mode3_process_sub')

   }


   mode1_process_sub {

     # If errors go back to 'mode1_sub'

     # Everything OK!
     # Want to go to mode2_sub but cannot set the 'rm' hidden variable
as I have lost the template 1 context!. What to do?

   }

   mode2_process_sub {

     # If errors go back to 'mode2_sub'

     # Everything OK!
     # Want to go to mode3_sub but cannot set the 'rm' hidden variable
as I have lost the template 2 context!. What to do?

   }

   mode3_process_sub {

     # If errors go back to 'mode3_sub'

     # Everything OK!
     # Want to go to mode4_sub but cannot set the 'rm' hidden variable
as I have lost the template 3 context!. What to do?

   }

   Using $self->header('redirect') and $self->header_props() would not
   work in my case since it's a run mode and not a URL that I am after.

   Please advise. I have tried to be as detailed as possible without
cluttering the screen with code. If any more details are needed, please
   let me know.

Thanks,
Sharad

   


		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


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