Skip to content

Commit

Permalink
Support computed stringList variables #212
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Sep 28, 2023
1 parent b28d0db commit 8dbd40c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion grails-app/assets/javascripts/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,20 @@ function orEmptyArray(v) {
return result;
}

function evaluateArray(expression, context) {
var result = evaluateInternal(expression, context);
if (!_.isArray(result)) {
result = [result];
}
return result;
}

return {
evaluate: evaluateNumber,
evaluateBoolean: evaluateBoolean,
evaluateString: evaluateString,
evaluateUntyped: evaluateUntyped
evaluateUntyped: evaluateUntyped,
evaluateArray: evaluateArray
}

}();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class ComputedValueRenderer {
case 'date':
expressionType = 'evaluateString'
break
case 'stringList':
expressionType = 'evaluateArray'
break
default:
expressionType = "evaluate"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ValidationHelper {
criteria.each {
switch (it.rule) {
case 'required':
if (model.type == 'selectMany') {
if (model.type == 'selectMany' && !model.readonly && !dataModel.readonly) {
values << 'minCheckbox[1]'
}
else {
Expand Down

0 comments on commit 8dbd40c

Please sign in to comment.