title: How to get all key-value pairs of a PDF form fields using javascript in Acrobat?
body: <p>I have searched and found out code snippet for getting a value for particular field in a PDF using javascript in Acrobat.</p>
  
  <p>But I need to get all fields as key-value pair in javascript. I tried some of the code but it won't work for me.</p>
  
  <pre><code>if(this.hostContainer) {    
          var names = new Array();    
          names[0] = this.getField("personal.name").value.toString(); 
          names[1] = this.getField("personal.loginname").value.toString();    
          try{    
              this.hostContainer.postMessage(names);  
          }   
          catch(e){   
              app.alert(e.message);   
          }   
  }
  </code></pre>
  
  <p>PDF file looks like below,</p>
  
  <blockquote>
    <p>Name : x (editable)</p>
    
    <p>Age : 36 (editable)</p>
    
    <p>Sex : male (editable)</p>
  </blockquote>
  
  <p>But the form fields in PDF may vary.</p>