Skip to main content

CGI plugin sequence of events

In general, a CGI program executes a CGI plugin at least twice; once to retrieve HTML for initial display (the form elements that the user can access to invoke plugin functionality), and again to process the user’s input.

This is illustrated by the following sequence of events:

  1. CGI program runs the plugin with one of the inputs being action = "PRINT-FORM" .

  2. Plugin prints state variables (which the CGI stores on behalf of the plugin), a list of HTML tags that if received the CGI should forward to the plugin, and an HTML snippet to display to the user.

  3. CGI program assembles an HTML page from the normal page functionality and the HTML snippet received from the plugin.

  4. CGI program displays the resulting combination on the user’s web browser.

  5. CGI program accepts input (form submission) from the user.

  6. CGI program determines whether one of the plugin’s buttons was pressed. Terminate this logic if not.

  7. CGI program runs the plugin with the action = "PROCESS-FORM" input.

  8. CGI program forwards all previously-stored state information and form input variables to the plugin.

  9. Plugin produces the next HTML snippet, to be included in the next HTML page, possibly including new state information.

By default, new HTML code supplied by the plugin is inserted at the bottom of the page. You can change the location as described in Change the layout .

Read the following sections to lean about each type of CGI plugin.