When I run into this, I add that logic before running check_rm:

sub my_runmode {
  my $self = shift;
  my $query = $self->query();
  my $profile = $self->_validate_taskform();

  if ( grep { $_ eq 'Help Desk' } $query->param( 'project_names' ) ) {
    $profile->{'constraints'}->{'task_names'} = 'qr/^\d{9}$/';
  }
  my $results = $self->check_rm( 'prev_runmode', $profile )
    || return $self->check_rm_error_page;
}

(untested disclaimer, etc...)

- Jason

Robert Hicks wrote:
I have a drop down that contains different task names. When the end user selects the "Help Desk" from "project_names" then "task_names" has to be 9 numbers long.

This is my current code for validation:

sub _validate_taskform {
    my $self = shift;

    return {
        required => [
qw/user_name clin_id charge_ids project_names start_date end_date total_hours/
        ],
require_some => { task_or_add_task => [ 1, qw/task_names add_task/ ] },
        filters     => ['trim'],
constraints => { total_hours => qr/^(\d*(\.((00?)|(25)|(50?)|(75))0*)?)$/, },
        msgs => {
            any_errors => 'err__',
            prefix     => 'err_',
            missing    => '',
        }
    };
}


Any thoughts?

Robert

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to