Speaking of toolbar buttons.  Another common practice is to add a toolbar button that will perform some complex operation in JavaScript.  Since you generally don't want the JavaScript itself inside your isv.config.xml file, you need a place to put it where it's easily maintained.  How about in the Form's OnLoad event?

Buttons are added to the toolbar by modifying the isv.config.xml and inserting code similar to the following:

<Button
    Title="DoIt"
    ToolTip="Do something interesting"
    Icon="/_imgs/ico_16_1071.gif"
    JavaScript="MyCustomFunction();"
/>

Inside the Form's OnLoad event, we declare our MyCustomFunction() like this:

   1: MyCustomFunction = function()
   2: {
   3:  alert("we're doing something interesting here...");
   4: }

 

By adding the function to the OnLoad event, you centralize your JavaScript functions which will usually decrease your maintenance requirements since all of the code is in one place. Also, since we're working inside the form, we have access to the Form's attributes as we normally would.