Tuto WEBDEV 25
34 Part 1: Discovering WEBDEV In our example, all input checks are performed in browser code (green code). For example, the EDT_LastName control must not be empty. The corresponding code is as follows: // Check whether the "EDT_LastName" control is equal to empty string // (excluding spaces and punctuation) IF EDT_LastName ~= "" THEN // The control is empty, display an error message to the user Error("Type your last name") // Return in edit into the "EDT_LastName" control (without running // the rest of code) ReturnToCapture(EDT_LastName) END This check is performed in browser code because there is no need to go back to the server to check that the controls are filled. This is used to avoid useless round trips and to reduce the wait for the Web user: the navigation is more fluid. Once the browser code was run, the page sends the values typed to the server. Then, the server runs the server code. In the server code, you have the ability to process the information received. In our example, the information received is added into the database via the following code: // Reset the customer structure HReset(Customer) // Get the values of controls in // the customer structure ScreenToFile() // Add the customer into the database HAdd(Customer) This operation cannot be performed in browser code because the database is common to all site users and therefore it is located on the server. ▶ Close the code window (click the cross in the top right corner). ▶ Close the page displayed in the editor (click the cross in the top right corner).
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==