context.registerWidget(discontinuedDateWidget);
context.registerErrorWidget(discontinuedDateWidget, discontinuedDateErrorWidget);
}
if (parameters.get(FIELD_DISCONTINUED_REASON) != null){
String discReasonConceptStr = (String) parameters.get(FIELD_DISCONTINUED_REASON);
Concept discontineReasonConcept = HtmlFormEntryUtil.getConcept(discReasonConceptStr);
if (discontineReasonConcept == null)
throw new IllegalArgumentException("discontinuedReasonConceptId is not set to a valid conceptId or concept UUID");
dof.setDiscontinuedReasonQuestion(discontineReasonConcept);
discontinuedReasonWidget = new DropdownWidget();
discontinuedReasonErrorWidget = new ErrorWidget();
List<Option> discOptions = new ArrayList<Option>();
discOptions.add(new Option("", "", false));
if (parameters.get(FIELD_DISCONTINUED_REASON_ANSWERS) != null){
//setup a list of the reason concepts
List<Concept> discReasons = new ArrayList<Concept>();
String discAnswersString = (String) parameters.get(FIELD_DISCONTINUED_REASON_ANSWERS);
String[] strDiscAnswers = discAnswersString.split(",");
for (int i = 0; i < strDiscAnswers.length; i++){
String thisAnswer = strDiscAnswers[i];
Concept answer = HtmlFormEntryUtil.getConcept(thisAnswer, "discontinueReasonAnswers includes a value that is not a valid conceptId or concept UUID");
discReasons.add(answer);
}
if (parameters.get(FIELD_DISCONTINUED_REASON_ANSWER_LABELS) != null){
// use the listed discontinueReasons, and use labels: