Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUI-136 : trimm off unnecesasry characters from the converted input s… #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this function doing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it converts the string(concept object) eg "concept #12" to a numeric string (concept id) eg "12"

return conc.replace(/[^\d.]/g,'');
}

function func${escapedFormFieldId}AutoCompleteOnSelect(concept, item) {

var conceptId = concept ? concept.conceptId : null
Expand Down