SUBROUTINE PUTEX
     * Display a simple form, requesting entry of name and age.
     * An image is provided, that when clicked, runs a JavaScript
     * function to verify that the data is valid. If valid, the 
     * data is submitted to the server.
     * The graphic changes when the mouse is pointing to the image
     * and when the image is clicked.

     *Include the RealWeb definitions
     INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP

      * Get the URL of the Reality item server.
     IMAGEFILE = ""
     CALL RW_GET_PARAM("__isurl", IMAGEFILE)
     * Specify the location of the file containing the images.
     IMAGEFILE = IMAGEFILE : "/REALWEB-ITEMS/"

    * Start the HTML page.
     CALL RW_START_HTML_PAGE("PUTEX", "", "", "", "")

     * Get the JavaScript code.
     VERIFY = ""
     CALL RWA_INSERT_ITEM(VERIFY, "REALWEB-ITEMS", "verify2.js")
     * Put the code in the JavaScript buffer.
     CALL RW_PUT_EX(VERIFY, RWD_JAVASCRIPT)

     * Start the HTML form, specifying that the subroutine HELLO
     * should be run when the form is submitted.
     CALL RW_START_HTML_FORM("HELLO", "FORM1", "")

     * Create the editboxes.
     CALL RW_START_PARA("", "")
     CALL RW_PUT("Name: ")
     CALL RW_EDIT_BOX("NAME", 30, "")
     CALL RW_END_PARA
     CALL RW_START_PARA("", "")
     CALL RW_PUT("Age: ")
     CALL RW_EDIT_BOX("AGE", 10, "")
     CALL RW_END_PARA

     *Create an image to act as a submit button.
     CALL RW_START_PARA("", "")
     IMAGES = ""
     IMAGES<1> = IMAGEFILE : "submit1.gif"
     IMAGES<2> = IMAGEFILE : "submit2.gif"
     IMAGES<3> = IMAGEFILE : "submit3.gif"
     CALL RW_IMAGE_FUNCTION('verify();', "Submit", IMAGES, "")
     CALL RW_END_PARA

     *Complete the form
     CALL RW_END_FORM

     * Complete the page.
     CALL RW_END_PAGE
RETURN

Go to top button