Example #1
0
// Add minimum number of selections for a selection answer
func (question *QuestionForm) AddSelectionAnswerMinSelections(selections int) {
	answer := question.getCurrentAnswer()
	if answer.SelectionAnswer == nil {
		answer.SelectionAnswer = &questionform.TSelectionAnswerType{}
	}
	answer.SelectionAnswer.MinSelectionCount = xsdt.NonNegativeInteger(selections)
}
Example #2
0
// Add length constraints for a free text answer specification
func (question *QuestionForm) AddFreeTextAnswerLengthConstraints(min, max int) {
	answer := question.getCurrentAnswer()
	if answer.FreeTextAnswer == nil {
		answer.FreeTextAnswer = &questionform.TFreeTextAnswerType{}
	}
	if answer.FreeTextAnswer.Constraints == nil {
		answer.FreeTextAnswer.Constraints = &questionform.TxsdFreeTextAnswerTypeSequenceConstraints{}
	}
	if answer.FreeTextAnswer.Constraints.Length == nil {
		answer.FreeTextAnswer.Constraints.Length = &questionform.TxsdFreeTextAnswerTypeSequenceConstraintsSequenceLength{}
	}
	answer.FreeTextAnswer.Constraints.Length.MinLength = xsdt.NonNegativeInteger(min)
	answer.FreeTextAnswer.Constraints.Length.MaxLength = xsdt.PositiveInteger(max)
}