in reply to Life, Love and CGI::Application::Plugin::ValidateRM (and Friends)
First off, remember that HTTP is a stateless protocol, which means that the server(s) do not share any data between requests. You need to do that explicitly, either by putting data in the url, or in a form, or in a session.
The next request finds the user id with $self->query->param('user') as well.<form action="myapp"> <input type="hidden" name="rm" value="save"> <input type="hidden" name="user" value="1">
sub edit { my $self = shift; my $user_id = $self->query->param( 'user' ); $self->session->param( user => $user_id ); # store it ... } sub save { my $self = shift; my $user_id = $self->session->param( 'user' ); # retrieve it ... }
Hope that helps :)sub display_form { ... } sub process_form { my $self = shift; my @input = data_from_query_or_session(); # use CAP::ValidateRM here my @errors = validate( $profile, @input ); if( @errors ) { # HTML::FillInForm makes this easier return $self->display_form( @errors ); } # submission was ok, process the data ... }
|
|---|