How to control sorting of answer concepts in drop down and radio lists

Platform Version: 1.11.2 Build 3854fe WAR 2015-04-20 21:42 OpenMRS Version: N/A

Question: When adding answer concepts to a coded concept in the concept dictionary, you are allowed to control the order in which the answer concepts are listed (by moving them up and down in the list). This suggested to me that this order might control how they are listed in drop-down menus and radio button lists for the HTML Form Entry Module. However, whenever I add a coded concept to my form, the drop-down menu or radio button list is always sorted alphabetically according to the current selected language. Is there a way to disable this automatic sorting of the concepts? I have set their order to match paper forms which I am trying to replicate within OpenMRS.

I am aware that you can force the list order by explicitly listing the answer concepts like this:

<obs conceptId="1234" answerConceptIds="2000,4000,3000"/>

but this will not automatically add new answer concepts that may be assigned to the coded concept.

1 Like

@tlroose I agree with you, it would be ideal to look up the order of drop-down answers from the order set in the dictionary.

@community Is there an existing way of doing that ? Or should we tweak HTML Form Entry to default to this behavior ?

Looks like HTML Form Entry by default sorts alphabetically based on the localized name. I think we’d want to keep this default, but I’d be fine with added an optional attribute to the obs tag specifying that they should be sorted by sort weigh.