Skip to content

Commit

Permalink
formating the concpet id value to a numeric string
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzy11 committed Mar 15, 2019
1 parent 521d14f commit 66da78e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ public List<Object> findBatchOfConcepts(String phrase, boolean includeRetired, L
* @param conceptId the id to look for
* @return a {@link ConceptListItem} or null if conceptId is not found
*/
public ConceptListItem getConcept(Integer conceptId) {
public ConceptListItem getConcept(String phrase) {

//trimming off unnecesarry characters to remain with a Pure Numeric String that can be converted to ConceptId
String numeric_phrase = phrase.replaceAll("Concept #", "").trim();
Integer conceptId = Integer.valueOf(numeric_phrase);
Locale locale = Context.getLocale();
ConceptService cs = Context.getConceptService();
Concept c = cs.getConcept(conceptId);
Expand Down
7 changes: 6 additions & 1 deletion omod/src/main/webapp/tags/conceptField.tag
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
<c:if test="${not empty initialValue}">
// fetch the concept object they passed the value in of and do the normal "select" stuff
DWRConceptService.getConcept("${initialValue}", function(concept) { func${escapedFormFieldId}AutoCompleteOnSelect(concept); });
DWRConceptService.getConcept(convert("${initialValue}"), function(concept) { func${escapedFormFieldId}AutoCompleteOnSelect(concept); });
</c:if>
<c:if test="${not empty showAnswers}">
Expand All @@ -76,6 +77,10 @@
})
function convert(conc){
return conc.replace(/[^\d.]/g,'');
}
function func${escapedFormFieldId}AutoCompleteOnSelect(concept, item) {
var conceptId = concept ? concept.conceptId : null
Expand Down

0 comments on commit 66da78e

Please sign in to comment.