-
-
Save hesco/1782d63d3b9cc8cc3894 to your computer and use it in GitHub Desktop.
The behavior I seek is that an invalid submission reloads the previously entered data and returns the user to the form, to correct invalid data, assisted by error messages exposed on the form. Any pointers would be appreciated. Thanks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub free_concierge_service { | |
my $self = shift; | |
$self->app->log->debug('TRACE: entering ->free_concierge_service().'); | |
my $validation = $self->validation; | |
return $self->render unless $validation->has_data; | |
$validation->required('add_to_list')->in( qw( apply_for_concierge_service beta_launch_list ) ); | |
$validation->required('prospect.email'); | |
$validation->required('prospect.fname'); | |
$validation->required('prospect.lname'); | |
$validation->required('prospect.phone'); | |
my $cfg = $self->app->config; | |
my $schema = TFC::DB->open_connection( $cfg ); | |
my $list_type = $self->get_list_type( $schema ); | |
if ( $list_type->list eq 'apply_for_concierge_service' ){ | |
$validation->required('applicant.address'); | |
$validation->required('applicant.city'); | |
$validation->required('applicant.state'); | |
$validation->required('applicant.zip'); | |
} | |
$self->app->log->debug('$validation is: ' . Dumper( $validation->{'error'} ) ); | |
if( $validation->has_error ){ | |
# this log message is untested still. | |
$self->app->log->debug('Validation error found: ' . Dumper( $validation ) ); | |
return $self->render( template => 'landing_pages/free_concierge_service', format => 'html' ); | |
} | |
my $prospect = $self->insert_prospect(); | |
$self->send_email_response( $prospect ); | |
$self->render( template => 'landing_pages/thanks', format => 'html' ); | |
$self->app->log->debug('TRACE: exiting ->free_concierge_service().'); | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment