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.
var doc:NotesDocument = currentDocument.getDocument();
var email = doc.getItemValue("email");
_dump("Email: " + email);
var password = doc.getItemValue("password");
_dump("Password: " + password);
I can see the values are empty in my log.nsf by using the "_dump" command.
When I use client side JS to grab the fields, they are populated -- I can see in the alert statements:
var doc = document;
var email = doc.getElementById("#{id:email1}").value;
alert(email);
var password = doc.getElementById("#{id:password1}").value;
alert(password);
I tried a partial refresh on the panel where the email and password fields exist, but that still didn't help.
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.
Thanks!