0

How come it did not return the current value of computed field when submitting the xpages?

var newHTTPPassword = this.userProfileXspDoc.getValue("HTTPPassword");

where HTTPpassword is a computed field with a formula

@Password(HTTPPassword_1).

The xpages is computed on both.

1 Answers1

1

Computed fields are in Notes forms only. When you submit a XPage the submitted values are available in the submission events, but not the modifications that the "computeWithForm" using the Notes form will do to it. Unless your are refitting an existing application with lots of @Logic in the form I would try to avoid computing with form. Use session.evaluate for the transformation (that also saves you the need of having 2 fields). As Per suggested .getSubmittedValue() might work. However I would rather bin the Input field HTTPassword_1 to viewScope.password do something like this in the querySave:

if (viewScope.password) { // If it isn't empty
    var realPassword = session.evaluate("@Password(\""+viewScope.password+"\")");
    userProfileXspDoc.setValue("HTTPPassword",realPassword);
    // Clear the scope for next round?
    viewScope.password = null;
}

That removes your need to clear out the HTTPassword_1 from your document.

Let us know how it goes

stwissel
  • 20,110
  • 6
  • 54
  • 101
  • This is a very useful information to understand that. I was thinking that NotesXspDcoument.getValue('fieldName') will get whatever the latest computed value when on submitting the xpages. I was deadly wrong. Thanks much. – Dragon Chow Sep 30 '13 at 18:30