SUBROUTINE INSERTITEM
* Display a simple form, requesting entry of name and age.
* On submission, call a JavaScript function to verify that
* the data is valid before sending it to the server.

* Include the RealWeb definitions.
INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP
EQU LF TO CHAR(10)

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

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

* Get the JavaScript code and put it in the JavaScript buffer.
CALL RW_INSERT_ITEM("REALWEB-ITEMS", "verify.js", RWD_JAVASCRIPT)

* 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 the submit button.
CALL RW_START_PARA("", "")
CALL RW_SUBMIT_BUTTON("Submit", 'onClick="return verify();"')
CALL RW_END_PARA

* Complete the form.
CALL RW_END_FORM

* Complete the page.
CALL RW_END_PAGE
RETURN