Skip to content

Commit 66da78e

Browse files
committed
formating the concpet id value to a numeric string
1 parent 521d14f commit 66da78e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

omod/src/main/java/org/openmrs/web/dwr/DWRConceptService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ public List<Object> findBatchOfConcepts(String phrase, boolean includeRetired, L
236236
* @param conceptId the id to look for
237237
* @return a {@link ConceptListItem} or null if conceptId is not found
238238
*/
239-
public ConceptListItem getConcept(Integer conceptId) {
239+
public ConceptListItem getConcept(String phrase) {
240+
241+
//trimming off unnecesarry characters to remain with a Pure Numeric String that can be converted to ConceptId
242+
String numeric_phrase = phrase.replaceAll("Concept #", "").trim();
243+
Integer conceptId = Integer.valueOf(numeric_phrase);
240244
Locale locale = Context.getLocale();
241245
ConceptService cs = Context.getConceptService();
242246
Concept c = cs.getConcept(conceptId);

omod/src/main/webapp/tags/conceptField.tag

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
6262
<c:if test="${not empty initialValue}">
6363
// fetch the concept object they passed the value in of and do the normal "select" stuff
64-
DWRConceptService.getConcept("${initialValue}", function(concept) { func${escapedFormFieldId}AutoCompleteOnSelect(concept); });
64+
65+
DWRConceptService.getConcept(convert("${initialValue}"), function(concept) { func${escapedFormFieldId}AutoCompleteOnSelect(concept); });
6566
</c:if>
6667
6768
<c:if test="${not empty showAnswers}">
@@ -76,6 +77,10 @@
7677
7778
})
7879
80+
function convert(conc){
81+
return conc.replace(/[^\d.]/g,'');
82+
}
83+
7984
function func${escapedFormFieldId}AutoCompleteOnSelect(concept, item) {
8085
8186
var conceptId = concept ? concept.conceptId : null

0 commit comments

Comments
 (0)