diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 13b579282..bd708492a 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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) diff --git a/lib/WebGUI/Asset/Wobject/SQLForm.pm b/lib/WebGUI/Asset/Wobject/SQLForm.pm index 08a7a50ee..3524ed2ef 100644 --- a/lib/WebGUI/Asset/Wobject/SQLForm.pm +++ b/lib/WebGUI/Asset/Wobject/SQLForm.pm @@ -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});