Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Need to sort drop-down box list

Avatar

Former Community Member
How do we go about sorting in ascending/decending order a drop-down box list of text/name items?
4 Replies

Avatar

Former Community Member
Unfortunately, neither the XFA nor AcroForm (Acrobat Form) Objects have methods or properties to let you sort a list box or drop down list (or specify it as being "sorted").



This means you're going to have to write some script to do the sorting.



Since this isn't trivial, I thought I would provide a sample form which sorts items in a list (either a list box or drop down list will work) in ascending or descending order and either by text or value items.



All the script is located in the "ScriptObject" script object and gets called from the Sort button.



Since I don't know your level of understanding when it comes to JavaScript, I just included a lot of comments to help explain what's going on. If you have any questions, please let me know.



Stefan

Adobe Systems

Avatar

Former Community Member
Thank you for your help, Stefan. I'll review your enclosure and let you know if we need further help.

Nita

Avatar

Former Community Member
The Enclosure doesn't work with Acrobat 8.0 . If i click on the button Sort nothing happens ... Has anybody an Idea why?

Avatar

Former Community Member
Christian,



Thanks for pointing this out. It looks like Acrobat 8.0 broke something that prevents my sample form from working correctly.



It has to do with the call to



resolveNodes("#items[*]")



Fortunately, the bug will be fixed in Acrobat's next release.



As a workaround, I would encourage you to have a look at the
new list object properties and methods now available in Acrobat 8.0. You should be able to use a combination of those new properties/methods along with some of the original script in this sample in order to come-up with an update solution that works.



Stefan

Adobe Systems



More answers on
FormBuilder.