예제 #1
0
파일: question.go 프로젝트: jesand/crowds
// 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)
}
예제 #2
0
파일: question.go 프로젝트: jesand/crowds
// 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)
}