09 Nov
Posted by: mitch in: Customization, Dynamics CRM
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.
3 Responses
Techy News » Blog Archive » Calling a custom JavaScript function from a custom toolbar button
09|Nov|2007 1[...] Read the rest of this great post here [...]
Calling a custom JavaScript function from a custom toolbar button by hgwebhost
10|Nov|2007 2[...] read more here [...]
hosthg » Blog Archive » Calling a custom JavaScript function from a custom toolbar button
13|Nov|2007 3[...] full story here [...]
Leave a reply