title: Grab client-side field value in server-side JavaScript in XPages
body: <p>I seem to be missing something with XPages.  I have a button that has server side JS which is attempting to get the value from the 2 existing fields on the document.  I enter values in the form and the field values are empty when the button is clicked.</p>
  
  <pre><code>var doc:NotesDocument = currentDocument.getDocument();
  var email = doc.getItemValue("email");
  _dump("Email: " + email);
  var password = doc.getItemValue("password");
  _dump("Password: " + password);
  </code></pre>
  
  <p>I can see the values are empty in my log.nsf by using the "_dump" command.</p>
  
  <p>When I use client side JS to grab the fields, they are populated -- I can see in the alert statements:</p>
  
  <pre><code>var doc = document;
  var email = doc.getElementById("#{id:email1}").value;
  alert(email);
  var password = doc.getElementById("#{id:password1}").value;
  alert(password);
  </code></pre>
  
  <p>I tried a partial refresh on the panel where the email and password fields exist, but that still didn't help.</p>
  
  <p>Do I have to save the document first and grab the document again to get the field values?  Do I have to pass the field values in client side JS and then pass in a scope (I don't think that can be done from client side JS)?  It is probably a simple solution but I am not sure why this is happening.</p>
  
  <p>Thanks!</p>