fixed: SQL Form fields with a regex are required even if not set to required

This commit is contained in:
Graham Knop 2008-03-19 22:37:03 +00:00
parent da5877eb3d
commit a34025fbc9
2 changed files with 3 additions and 1 deletions

View file

@ -2763,7 +2763,8 @@ my $cmd = '$self->session->form->'.$field->{formFieldType}.'($fieldName)';
}
# Check if input matches its regex
if (_matchField($self, $self->session->form->process($fieldName), $field->{regex})) {
if ($self->session->form->process($fieldName) eq '' && !$field->{isRequired} ||
_matchField($self, $self->session->form->process($fieldName), $field->{regex})) {
push(@update, "$fieldName = ".$self->session->db->quote($fieldValue));
} else {
push(@error, $i18n->get('ers regex mismatch').' '.$regexes{$field->{regex}}.' '.$field->{displayName});