File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -483,7 +483,7 @@ public function isValidValue($value): bool {
483483 public function isValid (): bool {
484484 if (!is_null ($ this ->getField ())) {
485485 // If the field is required it can't be empty
486- if ($ this ->getField ()-> fields [ ' mandatory ' ] && $ this -> value == '' ) {
486+ if ($ this ->isAdditionalFieldEmpty () ) {
487487 Session::addMessageAfterRedirect (
488488 __ ('A required field is empty: ' , 'formcreator ' ) . ' ' . $ this ->getLabel (),
489489 false ,
@@ -498,6 +498,20 @@ public function isValid(): bool {
498498 return true ;
499499 }
500500
501+ /**
502+ * Undocumented function
503+ *
504+ * @return boolean
505+ */
506+ private function isAdditionalFieldEmpty (): bool {
507+ switch ($ this ->getField ()->fields ['type ' ]) {
508+ case 'dropdown ' :
509+ return $ this ->getField ()->fields ['mandatory ' ] && $ this ->value == 0 ;
510+ }
511+
512+ return $ this ->getField ()->fields ['mandatory ' ] && $ this ->value == '' ;
513+ }
514+
501515 public function moveUploads () {
502516
503517 }
You can’t perform that action at this time.
0 commit comments