Tuto WEBDEV 25
Part 3: Intranet site with data 123 7. Save the modifications by clicking among the quick access buttons. The compilation errors disappear. 8. Close the code editor. Our image can now be uploaded on the server. All you have to do now is save the image in the database. ▶ To save the image in the Product data file: 1. Display the code of the "Validate" Button control: • Select the "Validate" Button control. • Press F2. 2. In the "Click (server)" event, add the following code AFTER the call to PageToFile : IF gsImagePath<>"" THEN Product.Visual = fLoadBuffer(gsImagePath) END 3. Let’s take a look at this WLanguage code: • This code checks the content of gsImagePath global variable. If this variable does not correspond to an empty string, it means that the image was uploaded by the user. In this case, the "Visual" item of Product data file is filled with the binary image content. This content is retrieved by fLoadBuffer . • HModify (already found in the code) is used to save the changes in the data file. 4. Save the modifications ( or Ctrl + S). 5. Close the code window. Displaying the form from the list of products Now, let’s see how to display the form of the product selected in the list of products. The principle is straightforward: the user will select the product in the Looper control and will display the details via a Link control. ▶ We are going to modify "PAGE_List_of_products" in order to create a modification Link control: 1. Position the cursor on the "List of products" page: click the "PAGE_List_of_products" button in the open documents bar: 2. On the "Creation" pane, in the "Usual controls" group, click "Link".
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==