XI (doc) – Mapping forms to URLs

XI (doc) – Mapping forms to URLs

In previous versions of IntraWeb the only way to map a URL to a form was to pass a parameter to the start URL. This is similar to passing command line parameters to an application. This sufficed in many circumstances, but of course users still requested the ability to map a real URL to a form, as well as the ability to bookmark forms.

XI allows this. While it seems simple and many expected this should have been added a long time ago, it is anything but simple.

Mapping a URL

A form can be mapped to a URL as shown here.

initialization
  TIWURLMap.Add(‘/red/’, ‘index.html’, TfrmRed);
end.

The arguments for Add in order are:

  • Path
  • File
  • Class of the form.

In this example, this form will respond to /red/index.html, or simply /red/. If file is an empty string, it will respond to /red/*. Any document will match. For more information, see URL Responders as they use the same registration routines.

Sessions

If a session is found, the existing session will be used for the form. If no session is found, a new one will be created. Thus, URL mapped forms can serve as start URLs. To allow bookmarking, the URL will remain in the browser, even if a new session is created.

Form Stack

A new instance of the form will be created, and shown. This will causeit to be the new active form and on top of the form stack.

If the user continually refreshes the URL, or clicks a lot of links mapped to forms, this can cause form instances to pile up on the stack. If this is a concern, you may wish to monitor or occasionally prune duplicate or old form instances from the user’s form stack.

Because the form stack is used, it is also important that mapped URLs are no used for new windows. If this occurs, the first window will be out of sync with the form stack and the user will receive an error when submitting that form. In future versions of IntraWeb we plan to add options for handling multiple windows concurrently.