8 Replies Latest reply on Mar 6, 2014 11:19 AM by NHJB MHP

    How to change field name order within list?

    NHJB MHP Level 1

      Hi all,

      I am using a JavaScript taken from the forums which does what I need beautifully (thanks Gilad D) with 1 small wrinkle.  The script pulls the fields name of those fields that are marked as Required but have been left blank.  I have named the fields to correspond to the question number so the user will have a reference.  However the order is sorted numerically which means "#1" is followed by "#10"....


      1 - List authorizing facility

      10 - Date of submittal

      2 - Name of designee

      3 - Date of examination



      Is it possible to change this order?  This is the script I'm using:


      var emptyFields = [];

      for (var i=0; i<this.numFields; i++) {

           var f= this.getField(this.getNthFieldName(i));
           if (f.type!="button" && f.required ) {

                if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off") || (f.type=="combobox" && f.value=="  ")) emptyFields.push(f.name);


      if (emptyFields.length>0) {

           app.alert("Please check that the following fields are completed (if applicable) before continuing:\n" + emptyFields.join("\n"));