Sorting a list by birthday
Hi,
I am using Acrobat Pro DC and have created a form where you can enter
First Name (Name1), Last Name (NName1) and Birthday (B1)
To sort the list alphabetically (without birthday) I am using following code...
// Get the field values, as strings
var s1 = getField("Name1").valueAsString;
var l1 = getField("NName1").valueAsString;
var s2 = getField("Name2").valueAsString;
var l2 = getField("NName2").valueAsString;
var s3 = getField("Name3").valueAsString;
var l3 = getField("NName3").valueAsString;
// Combine values, separated by a space
event.target.value = s1 + " " + l1 + ",\n" + s2 + " " + l2 + ",\n" + s3 + " " + l3;
if(event.value!=""){
var names = event.value.split("\r");
names = names.sort(function(a,b){if(a<b)return -1; if(a>b)return 1; return0});
event.value=names.join("\r");
However, I would now like to incorparate the birthday and ideally put the list in order of the birthday from youngest to oldest or oldest to youngest.
What would I need to change in my java script? I would very much appreciate any help.
Thank you in advance.
