Commit cb380f9 1 parent 11d9e6b commit cb380f9 Copy full SHA for cb380f9
File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -483,7 +483,7 @@ public function isValidValue($value): bool {
483
483
public function isValid (): bool {
484
484
if (!is_null ($ this ->getField ())) {
485
485
// If the field is required it can't be empty
486
- if ($ this ->getField ()-> fields [ ' mandatory ' ] && $ this -> value == '' ) {
486
+ if ($ this ->isAdditionalFieldEmpty () ) {
487
487
Session::addMessageAfterRedirect (
488
488
__ ('A required field is empty: ' , 'formcreator ' ) . ' ' . $ this ->getLabel (),
489
489
false ,
@@ -498,6 +498,20 @@ public function isValid(): bool {
498
498
return true ;
499
499
}
500
500
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
+
501
515
public function moveUploads () {
502
516
503
517
}
You can’t perform that action at this time.
0 commit comments