In C:\db\scripts I have the js1.html file referred to under the Script1 label above:
<html>
<script>
  document.write("This text came from js1.html !");
</script>
</html>

The net result is a form that looks like this at design-time:
(Save and/or expand this image if you need to see it more clearly)

Output-only fields in designer will render output from script

And it looks like this at run-time:

Output rendered in test mode

There is another option for using scripting to control ActiveX controls and other special features. DesignBais allows you to launch a modal window to any URL you want. Use DBCALLURL from BASIC or specify a URL as the process to call on field events. With this you can open a custom web page, perhaps just a small dialog, to perform functions and then when the user closes that page they are back in their application. Depending on the consistency of the styles, the user may not realize he/she is is not even using a DesignBais form anymore. You can even launch a page that executes some function like scanning a document or printing to a local printer, and then have the page close itself.

Summary

It seems there are valid reasons to have JavaScript and equally valid reasons against it. It will be interesting to see where this goes, what DBI decides to support, etc.. If you do use scripts, be prepared to make changes as new versions of DesignBais come out – when using unsupported features we have no idea how or when things will break.

Now that you know more about scripting with DesignBais, do you have an application for it? Are you going to try it? Why or why not? Feel free to comment or to request specific examples.

Nebula Research and Development provides consultation and programming services for implementing the techniques described in this article. Examples of DesignBais extensions include creation of customized popup calendars, integrating forms with remote Web Services, exchanging data with Microsoft Outlook (Appointments, Calendars, Tasks, Contacts, Journals, Notes), importing and exporting Excel data, and integration with other software and hardware products. Please email for more information.