Upon click on the “select-order” item, the value “PENICILLIN V” fills in the auto-complete obs correctly.
However, the obs is not saved when hitting the Save button.
The user needs to click in the field, edit the text (like type or remove a letter) and pick from the auto-complete list to really validate the obs value.
After that, the obs will be saved correctly when clicking on the Save button
Note that this behavior doesn’t seem to match with the documentation:
Note that if setValue() method is used with an Autocomplete widget, the display value will not be updated, as the setValue method only updates the hidden value of Autocomplete widget. However once the form is saved and submitted, it will save the values correctly.
… and see if this would do what you want. If it does, but you don’t want to reference a concept by ID (since this is generally bad practice since IDs vary from DB to DB) you can do something ugly but workable like this:
var conceptId = "<lookup expression="fn.getConcept('concept-uuid-or-mapping')"/>" // hopefully I got the nested quotes right
jQuery("#select-order").click(function() {
setValue('drug-dispensed.value', conceptId);
});
Thanks @mogoodrich
I’ve tried to set it to its ID but it doesn’t work either.
I think the problem is not what is actually entered, it is more that the auto-complete field doesn’t seem to realize that it has been filled. Is there a change() method or something like this that I should call to “force” the field to update (similar as a user input) ?
OK. Sorry, it’s been so long since I worked on this that I can’t recall. I think we did not solve the issue though.
Here is the example form that was using the setValue functionality with the autocomplete attribute. You can take a look. But again, I don’t think we did anything to solve this in the end.