Closed gowthamsadasivam closed 5 years ago
This code worked.
survey.AskOne(prompt, &selected, func(in interface{}) error {
slist := in.([]string)
if !selectValidator(slist) {
return errors.New("Validation Failed!")
}
return nil
})
Hello,
I'm trying to validate a multiselect answer. For example one cannot have few combinations together as an answer. Currently, I'm doing it by a separate validation function in combination with an infinite for loop as below:
This will prompt the question again if the multiselect answer contains the combination of E1 & E2 together or B1 & B2 together by the validator function selectValidator().
I would like to know how to achieve this using the survey.AskOne(prompt, &selected, nil) Validator parameter.