I have a entity reference field, widget used is "Inline entity form - Multiple values". We can add multiple entries. When I have multiple values they are ordered by weights. How can I order them alphabetically ?


Try adding a customjs.js file to your Drupal site and reference it from basic.libraries.yml (in Drupal 7 its the theme.info file).

You could add there could acting upon your

  • items and sorts them alphabetically; There are many such JS codes (classic or Jquery).

    See this JQ code pen for example.

  • 2
    • Right now I am doing the same way you are suggesting. But once I open the form to edit it order changes as soon as ajax works. – He-mant Kr Aug 24 '16 at 3:18
    • Sorry I confused info file in D8 with libraries file... – user16289 Aug 24 '16 at 13:42

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

    Not the answer you're looking for? Browse other questions tagged or ask your own question.