Download Redbooks - Lotus software
Transcript
A brief explanation is given below: Default action: The value newDocument instructs XPages to effectively create a new document, by default, whenever this Custom Control is presented to the user. Run form validation: If you have input translation and input validation formulas on you form, “on document save” instructs XPages to process those formulas whenever the document is saved. Although the preferred method of validation is to place the validation code on the XPage itself, Domino gives you the flexibility (which is especially useful during application migrations from traditional to XPages design methodologies). 5.3.4 XPages data validation and translation Validating the value in a field is a common programming technique and requirement. Assume your form required a a field called Subject that is a required field (in other words, you cannot save the document unless this field is populated). To accomplish this, you can write an input validation formula for the field, resembling the following: @If(Subject = “” ; @Failure(“Please provide a subject”) ; @Success) This approach has the following implications: From the Notes Client side, execution of this formula would be fast, for the formula is run on the Notes Client. From the web client side, because web browsers cannot execute @Functions, the execution of this formula would result in a round trip to the server for processing The browser would execute the validation formula, and, assuming that the Subject field is empty, return the result of the @Failure message. You could implement the input validation using Javascript, however, this would increase the complexity of the application. 143 of 217