// special case to set the display field of the obs value widget when autocomplete is used with <obs> tag
else if (ConceptSearchAutocompleteWidget.class.isAssignableFrom(entry.getKey().getClass())) {
String conveptVal = lastSubmission.getParameter(widgetFieldName + "_hid");
Object returnedObj = HtmlFormEntryUtil.convertToType(conveptVal.trim(), Concept.class);
Concept concept = null;
if (returnedObj != null) {
concept = (Concept) returnedObj;
} else {
//This should typically never happen,why if there no obs with this id, we
//should set val(obsId) to blank so that the hidden form field is blank too
val = "";
}
sb.append("$j('#" + widgetFieldName + "').val(\""
+ (concept == null ? "" : JavaScriptUtils.javaScriptEscape(concept.getDisplayString())) + "\");\n");
sb.append("$j('#" + widgetFieldName + "_hid" + "').val(\"" + (concept == null ? "" : JavaScriptUtils.javaScriptEscape(concept.getId().toString())) + "\");\n");
sb.append("$j('#" + widgetFieldName + "').change();\n");
} else {
// set the value of the widget based on it's name
sb.append("setValueByName('" + widgetFieldName + "', '" + JavaScriptUtils.javaScriptEscape(val)
+ "');\n");