HyperTextMarkupLanguage

CGI Lab - Using a form

Home | Agenda |

CGI Lab - Using a form

Objective
Provide an html form through which a customer could register.

Example
See our example.

Resources

  • The customer file is CUS01 in your library CENTAUR2 .
    Please look at its DDS.

Perform as follow:

  1. Signon on AS/400 as QPGMR
  2. Develop your skeleton html member
    1. strpdm on source file mycgilib/htmlsrc
      and add member lab31a, source type html
    2. Write the following html sections
      1. section top starts the html
      2. section form displays the input form to be filled in
      3. section done congratulates the customer for having registered
  3. Develop your ILE-RPG CGI program
    1. Enter command
            cgidev2/crtcgisrc srcmbr(lab31a) srclib(mycgilib) option(3)
      to create the default ILE-RPG module source for this program in mysrclib/qrpglesrc
    2. Complete this source.
      • Your program should be able to handle two situations:
        1. issue the form
        2. receive data from the form, register the customer data, and send a response to the remote browser.
      • compile the module
      • create the CGI program
      • to test your CGI program, in the command line of your internet browser enter
        http://.../mysrclibp/lab31a.pgm
First upgrade
Your program should check that all input fields are filled in. If some input fields are not filled in, your program should
  1. issue and error message (section)
  2. trasmit back the inputs received, so that the user doesn't have to re-key in all the data
  3. signal with an appropriate color (for instance, red) the field(s) with data missing
Second upgrade
In the real life, you would assist your end-user by letting him select a country out of a list of countries, instead of letting him key in the name of his country.
This is done through a selection list.
Your next upgrade would be exactly this one.
  1. Input to your selection list is file centaur2/countries.
    You may browse its DDS.
  2. For the country, instead of an input field type=text, insert a selection list, in the same way as you did for the table-subfile.
    Html tags to be used are
    • <select name=xctrnam>
    • <option value selected>country_name
    • </select>

Lab solutions
Type Run it html rpg
Basic X X X
First upgrade X X X
Second upgrade X X X

Home | Agenda |

LAB31