Exemple #1
0
// Add maximum number of selections for a selection answer
func (question *QuestionForm) AddSelectionAnswerMaxSelections(selections int) {
	answer := question.getCurrentAnswer()
	if answer.SelectionAnswer == nil {
		answer.SelectionAnswer = &questionform.TSelectionAnswerType{}
	}
	answer.SelectionAnswer.MaxSelectionCount = xsdt.PositiveInteger(selections)
}
Exemple #2
0
// Add suggested number of lines for a free text answer specification
func (question *QuestionForm) AddFreeTextAnswerNumberOfLinesSuggestion(lines int) {
	answer := question.getCurrentAnswer()
	if answer.FreeTextAnswer == nil {
		answer.FreeTextAnswer = &questionform.TFreeTextAnswerType{}
	}
	answer.FreeTextAnswer.NumberOfLinesSuggestion = xsdt.PositiveInteger(lines)
}
Exemple #3
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)
}