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

@ -4,6 +4,7 @@
- fixed: Thingy has no icon
- fixed: Wiki page history shows username instead of alias
- added: Uploads locations and files are set to the same uid/gid that owns the uploads root
- fixed: SQL Form fields with a regex are required even if not set to required
7.5.6
- fixed: events get start/end time even when none specified (also can offset start/end day)

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});