Client-side Scripting in DesignBais

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.

4 thoughts on “Client-side Scripting in DesignBais

    • Tony,
      We at Laner Electric are currently evaluating DesignBais, which is what caused me to stumble across your blog in my research. Good Job!
      An issue that is tangential to THIS blog topic: Have you found any way to make an iframe to render on the page WITHOUT the bounding box? I’ve looked into this a bit (when trying to insert a PICK generated html snippet – specifically a table of reference information) and couldn’t find a way to turn off the visual bounding box.
      On second thought, this might NOT be an issue since we can use the technique you demonstrated for displaying "This came from js.html!" to embend the HTML for the table.
      Again – Thanks!! — Steve

    • Hi Steve – welcome to Neblog, and thanks for your comment and question!!

      Check the frameborder=0 attribute of the <iframe> tag in the first example. I intentionally removed the border from the first example and left it in the second. If you’re doing a table then you can similarly remove borders or change their width. You can also change background colors to try to get a uniform look across the page, and eliminate a coloring difference which might be a visual clue that an iframe is present.

    • Tony – Kewl – Thanks! Frankly, I was just struggling to USE it to imbed a .htm file and never got around to looking at the formatting options.
      One thing I DID find is that for iframes to work correctly from ie 6, then the url has to be from the same site as the page that embeds it. So if I want to programmatically generate html on the fly for imbedding using an iframe, I have to write it to a file that is within the url tree. Will probably somehow attach a network drive (which is actually a samba share) as a directory somewhere UNDER the root of the website running on WS2k3.
      Of course, the inability to have a url from another site COULD be just an artificate of my own IE6 security settings, but since I never tried to look deeper, I just may not have found the solution to THAT problem.
      –Steve

    • Hi Steve – yes the problem you are having wioth iframes from another site will be due to your ie6 security settings.The most common error is if a web page from one zone has an iframe from another then it will give you an error message. e.g. if  your designbais site is internet and your iframe is coming from your trusted sites. Make sure both sites are in the same zone.If there are still problems then there are a plethora of security settings that you may need to take a look at.Having said that, as you say above, the samba share and IIS virtual direcotry work well anyway.rgdsSymeon.

Leave a Reply