コード例 #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)
}