# Check to see if we're submitted and valid if ($form->submitted && $form->validate) { # Get form fields as hashref my $field = $form->fields; # Do something to update your data (you would write this) do_data_update($field->{lname}, $field->{fname}, $field->{email}, $field->{phone}, $field->{gender}); # Show confirmation screen print $form->confirm(header => 1); } else { # Print out the form print $form->render(header => 1); } #### # Check form if( $form->submitted ) { if( $form->validate ) { # More data munging $fields = $form->field; %tidy_fields = do_data_tidy($param_action, %{$fields}); # Amend Database $cfg::err_flag = 0; db_start_txn() if( !$cfg::err_flag ); update_database(%tidy_fields) if( !$cfg::err_flag ); db_commit_txn() if( !$cfg::err_flag ); if( !$cfg::err_flag ) { print $form->confirm(sticky => 1,header => 1); } else { #DEBUG log_msg("mytrap"); # Invalid; show form and allow corrections $cfg::err_flag = 0; $form->field(name => 'new_status', message => "Uknown change requested" ); $form->validate(new_status => 'NONE'); print $form->render(sticky => 1, debug =>2); } } else ....