Previous Walkthrough Next Walkthrough
Walkthrough 4: The HD$ Namespace -- Adding a Button to the Toolbar
Prerequisites:
Instructions:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EmploymentAgreement.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script type="text/javascript" src="http://files.hotdocs.ws/download/easyXDM.min.js"></script> <script type="text/javascript" src="http://files.hotdocs.ws/download/hotdocs.js"></script> </head> <body onload="HD$.CreateInterviewFrame('interview', '<%= GetSessionID() %>');"> <form id="form1" runat="server"> <h1>Employment Agreement Generator</h1> <div id="interview" style="width:100%; height:600px; border:1px solid black"> </div> </form> <script> HDInterviewOptions.OnInit = function () { HD$.AddCustomToolbarButton( function () { HD$.AnsGetVal('Employee Name', null, setSwappedName); }, 'btnswap.png', 'btnswaph.png', null, 'Swap first and last name'); }; </script> </body> </html>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EmploymentAgreement.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script type="text/javascript" src="http://files.hotdocs.ws/download/walkthrough/easyXDM.min.js"></script> <script type="text/javascript" src="hotdocs.js"></script> </head> <body onload="HD$.CreateInterviewFrame('interview', '<%= GetSessionID() %>');"> <form id="form1" runat="server"> <h1>Employment Agreement Generator</h1> <div id="interview" style="width:100%; height:600px; border:1px solid black"> </div> </form> <script> HDInterviewOptions.OnInit = function () { HD$.AddCustomToolbarButton( function () { HD$.AnsGetVal('Employee Name', null, setSwappedName); }, 'btnswap.png', 'btnswaph.png', null, 'Swap first and last name'); }; function setSwappedName(name) { HD$.AnsSetVal('Employee Name', name.split(' ').reverse().join(' '), null, function () { HD$.ScreenRefresh(); }); } </script> </body> </html>