This is my situation. I want to go to the next question (Question 5) if one of the questions (4.1, 4.2 or 4.3) have the checkbox “Yes”. So when 1 of them is being checked with Yes it have to go to question 5. The rest of the questions don’t have to be answered then.
You should configure the Behaviour on the fields 4.1: Question 4.1, 4.2: Question 4.2 and 4.3: Question 4.3
so with this code, you can get the selected value:
def checkBoxField = getFieldById(fieldChanged)
def checkBoxFieldValue = checkBoxField.value
// Collect the selected checkbox values
log.debug("The checkbox field value: '${checkBoxFieldValue}' of type '${checkBoxFieldValue.class.simpleName}'")
def chosenValuesList = []
if (checkBoxFieldValue in String) {
chosenValuesList.add(checkBoxFieldValue)
} else if (checkBoxFieldValue in ArrayList) {
chosenValuesList.addAll(checkBoxFieldValue)
}
and with that information you can check the following and make the otherField, in your case the questions that should be set as setHidden(true) to hide them, or .setReadOnly(true) to block the fields
// If the user has selected "None" and nothing else, don't force to populate the other field:
def otherField = getFieldByName(otherFieldName)
if (chosenValuesList == ['None']) {
checkBoxField.clearError()
otherField.setRequired(false)
otherField.setHidden(true)