List box, Sort Alphabetically as Items Add

I have created a List/Add box for the surname column as follows. Untitled When I add surnames to this, they are not alphabetically ordered. I suppose it is because the order no in the list. Can I avoid the order no? Or is there anyway to sort this alphabetically when added?

Untitled2

@H_A_R_Nilani,

By default, List Options in OpenEMR are sorted based on the Order Number . If you want to sort the particular list in alphabetical , you have to change list query with "order by " option. it requires some code customization.

Thanks,
ViSolve

I could be wrong but I thought if you left order number blank the list would auto sort alphabetically. Not 100% tho…

@sjpadgett - We are also tried by leaving the order number blank. It worked perfect. sorting has been done based on the title.Thanks for the info @sjpadgett :blush:.
@H_A_R_Nilani - you can make it simple, by leaving the order number blank.

Thanks,
ViSolve

It takes a community:). Glad it worked.

Thank you very much for your answers. My List box is an Add type, as you can see in the question. When a new item is added, an Order number is generated. How I can keep the Oder number blank for new items.

Untitled

@H_A_R_Nilani,
Code customization can be done to make it happen. Generally order number is generated based on calculation of maximum of sequence number plus one. Suggestion can be you can set the seq value = 0 for particular list_id and make the insertion to happen. So it won’t disturb other list_id. Kindly check the file library/ajax/addlistitem.php.

Thanks.
ViSolve